Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add skip_groups and skip_roles to okta_user #1007

Closed
monde opened this issue Mar 9, 2022 · 3 comments · Fixed by #1011
Closed

add skip_groups and skip_roles to okta_user #1007

monde opened this issue Mar 9, 2022 · 3 comments · Fixed by #1011
Assignees
Labels
enhancement Asking for new behavior or feature

Comments

@monde
Copy link
Collaborator

monde commented Mar 9, 2022

Customer ask:
Add boolean a skip_groups and skip_roles to resource okta_user so that unnecessary API calls to GET /api/v1/users/{userId}/roles and GET /api/v1/users/{userId}/groups are not made.

An example

terraform {
  required_providers {
    okta = {
      source = "okta/okta"
    }
  }
}

# in test org, there are 1000 users with login starting with "testprefix-"
data "okta_users" "important_users" {
  search {
    name       = "profile.login"
    value      = "testprefix-"
    comparison = "sw"
  }
}

resource "okta_group" "very_important_group" {
  name       = "very_important_group"
  skip_users = true
}

data "okta_user" "very_important_group" {
  for_each = toset([for user in data.okta_users.important_users.users: user.id])
  user_id  = each.key

  # The `okta_user` data source will make additional API calls to fill in group and role information.
  # If fields like `skip_groups` and `skip_roles` were added, these unnecessary API calls could be avoided.
  # skip_groups = true
  # skip_roles  = true
}

resource "okta_group_memberships" "very_important_group" {
  group_id = okta_group.very_important_group.id
  users    = [for user in data.okta_user.very_important_group : user.id]
}
@monde monde added the enhancement Asking for new behavior or feature label Mar 9, 2022
@monde monde self-assigned this Mar 9, 2022
@monde
Copy link
Collaborator Author

monde commented Mar 9, 2022

@virgofx does this interest you? I'm working on it.

@monde
Copy link
Collaborator Author

monde commented Mar 9, 2022

@virgofx
Copy link
Contributor

virgofx commented Mar 9, 2022

Nice -- yes all about performance. Go ahead and start as I've been swamped moving our org over into Okta past couple of weeks so not quite able to switch gears yet but I'll definitely review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Asking for new behavior or feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants