goauthentik/terraform-provider-authentik

authentik_stage_prompt_field placeholder not idempotent

lyz-code opened this issue · 0 comments

I have the next resource

resource "authentik_stage_prompt_field" "username" {
  field_key = "username"
  label     = "Username"
  type      = "text"
  order = 200
  placeholder = <<EOT
try:
    return user.username
except:
    return ''
EOT
  placeholder_expression = true
  required = true
}

Whenever I do a terraform plan or terraform apply the placeholder shows as a change even though it doesn't change anything

  # authentik_stage_prompt_field.username will be updated in-place
  ~ resource "authentik_stage_prompt_field" "username" {
        field_key              = "username"
        id                     = "336a7a60-c42c-46e4-ba16-329ffc82edc1"
        label                  = "Username"
        order                  = 200
      ~ placeholder            = <<~EOT
            try:
                return user.username
            except:
                return ''
        EOT
        placeholder_expression = true
        required               = true
        type                   = "text"
    }

Until this issue is solved you can patch it by adding a lifecycle directive to your resource definition

  lifecycle {
    ignore_changes = [
      placeholder,
    ]
  }

Note: it only happens on resources that have placeholder_expression = true