-
Notifications
You must be signed in to change notification settings - Fork 206
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
Do not sort okta_users datasource results #1155
Comments
Ah, sorry @monde ! Didn't notice there are already a couple of issues addressing this behaviour. Shall I close this one here? |
Let's keep this one open as well. |
@cbrgm let me know if https://github.com/okta/terraform-provider-okta/releases/tag/v3.29.0 fixes this for you. |
Hey @monde, that looks great! I can confirm that v3.29.0 fixes the problem and restores the old behavior of v.3.25.0. Thanks for your work and feedback! |
Due to a new sorting query parameter in the users datasource, some strange sorting of user ids happen when terraform tries to apply changes to our state. This behavior does not appear in v3.25.1 but was introduces in v3.26.0.
In my setup, I'm using the
okta_users
datasource to receive a list of users, create a map structure from the received results in the formuser.email
->user object
to assign users to applications, groups and so on.So using this map, users can we assigned via the email address as key to applications
This worked fine for months since I started using the provider, however after v3.26.0, when I run
terraform plan
, all user id's will be removed and added again, something like:In the end, it's not a big deal since every user removed, will be added again, but it completely destroys the use case of
terraform plan
as you cannot really spot important changes anymore.I guess it's a problem related to order not beeing an attribute of map structures, but of lists and since sorting was introduced to the
okta_users
datasource in v3.26.0 it's becoming a problem now. I'm not sure whether this is a bug, but it's definetly a breaking change. I'd appreciate any suggestions how to deal with this behavior, thanks in advance.Community Note
Terraform Version
v3.26.0+
Affected Resource(s)
Expected Behavior
terraform apply
should display only new changes only and not re-apply every datasource element due to datasource result sorting.Actual Behavior
See description.
Steps to Reproduce
Create a map structure from
okta_users
datasource results. Apply objects to anyokta_*_resource
terraform plan
The text was updated successfully, but these errors were encountered: