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
258 stars 209 forks source link

Feat: `data_okta_app_group_assignments` add `priority` and `profile` to schema #2047

Open exitcode0 opened 3 months ago

exitcode0 commented 3 months ago

The DataSource okta_app_group_assignments currently returns a list of Okta group IDs

The DataSource does not expose additional information that is returned in the API response This PR adds the group's priority and profile to the DataSource to make full use of the data returned to us in the API response

The impetus for this PR is that I need to test configuration changes to a large, heavily used application where it's group assignments are managed via an external system I have cloned the original Okta application and made the configuration changes to the new app in order to test there effects. Due to the original applications okta_app_group assignments being managed via an external system, I was unable to determine how I could easily clone/replicate the group assignment configuration from one application to the other

While I was ultimately able to find a workaround, The updates this PR introduce to this datasource would be ideal for this usecase

data "okta_app_group_assignments" "application_a" {
  id = okta_app_saml.application_a.id
}

resource "okta_app_group_assignments" "application_b" {
  app_id = okta_app_saml.application_b.id

  dynamic "group" {
    for_each = flatten(data.okta_app_group_assignments.application_a.groups)
    content {
      id       = group.value.id
      priority = group.value.priority
      profile = jsonencode(group.value.profile)
    }
  }
}
exitcode0 commented 3 months ago

@duytiennguyen-okta I would love to get your thoughts on this PR when you have the time 🙇

exitcode0 commented 3 months ago

@monde Any chance I could trouble you for a review on this PR?