okta / terraform-provider-okta

A Terraform provider to manage Okta resources, enabling infrastructure-as-code provisioning and management of users, groups, applications, and other Okta objects.
https://registry.terraform.io/providers/okta/okta
Mozilla Public License 2.0
256 stars 207 forks source link

custom_profile_attributes in okta_user only applies after okta_user resource is created #1553

Open pro4tlzz opened 1 year ago

pro4tlzz commented 1 year ago

Community Note

Terraform Version

1.2.2

Affected Resource(s)

Terraform Configuration Files

resource "okta_user" "user" {
  for_each = var.srvc_accounts

  first_name                = each.value.first_name
  last_name                 = each.value.last_name
  login                     = each.value.login
  email                     = each.value.login
  password                  = "somethingrandom"
  custom_profile_attributes = <<JSON
  {
    "custom_attribute_to_set": "value"
  }
  JSON
  custom_profile_attributes_to_ignore = [
    "foo",
    "bar"
  ]
}

Expected Behavior

The okta_user.user resource is created and the custom_attribute_to_set has the correct value set when the resource is created.

Can this be done in the Admin UI?

Yes

Can this be done in the actual API call?

Yes

Actual Behavior

The okta_user.user resource is created but the custom_attribute_to_set is not set. If a Terraform plan is run afterwards then an update to the okta_user.user resource for the custom_attribute_to_set property is described in the plan.

Steps to Reproduce

  1. terraform apply
  2. terraform plan
  3. terraform apply
monde commented 1 year ago

Thanks @pro4tlzz . It seems like the when the user is created the resource is not then setting the custom attributes to ignore. This is a bug, we'll look into it. Okta internal reference: https://oktainc.atlassian.net/browse/OKTA-611104

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days

pro4tlzz commented 1 year ago

Not stale

MichaelOtte-lhsystems commented 1 day ago

Not stale and still an open issue. I would assume that the property is setup on first apply (not subsequent) and any changes would be ignored