You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a terraform plan / terraform apply with the auth0_resource_server_scopes resource, scopes without a description are unexpectedly being destroyed and re-created.
This can cause issues when there exists Auth0 Roles that reference those corresponding permissions as terraform destroys the permission that is referenced by the role.
Expectation
If a scopes value on a auth0_resource_server_scopes resource does not change, then terraform should not attempt to modify it.
# ...resource"auth0_resource_server_scopes""my_api" {
resource_server_identifier=auth0_resource_server.my_api.identifier# existing scope without a descriptionscopes {
name="foobar"
}
# new scopescopes {
description="Fizz Buzz"name="fizzbuzz"
}
}
Then the terraform plan shows that the existing foobar scope will be destroyed and re-created.
$ terraform plan
...
Terraform will perform the following actions:
# auth0_resource_server_scopes.my_api will be updated in-place
~ resource "auth0_resource_server_scopes" "my_api" {
id = "9999999999999999999999"
# (1 unchanged attribute hidden)
- scopes {
- name = "foobar" -> null
# (1 unchanged attribute hidden)
}
+ scopes {
+ description = "Fizz Buzz"
+ name = "fizzbuzz"
}
+ scopes {
+ name = "foobar"
}
}
Plan: 0 to add, 1 to change, 0 to destroy.
I would expect terraform to not show any changes for the foobar scope, but rather only show adding the fizzbuzz scope.
Workaround
Adding description = "" to the scopes without a description seems to prevent this issue from occuring, which leads me to think there is an issue with a "" != null check when the terraform plan runs.
# ...resource"auth0_resource_server_scopes""my_api" {
resource_server_identifier=auth0_resource_server.my_api.identifier# existing scope with an empty string descriptionscopes {
description=""name="foobar"
}
# new scopescopes {
description="Fizz Buzz"name="fizzbuzz"
}
}
$ terraform plan
...
Terraform will perform the following actions:
# auth0_resource_server_scopes.my_api will be updated in-place
~ resource "auth0_resource_server_scopes" "my_api" {
id = "9999999999999999999999"
# (1 unchanged attribute hidden)
+ scopes {
+ description = "Fizz Buzz"
+ name = "fizzbuzz"
}
# (1 unchanged block hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
I think this workaround is not ideal though. It would be better if either the provider correctly handled diffing the scope values when the state contains an empty string but the code contains a null value for the description, or if the provider made the description property required (not null but still allowing for an empty string) on the scopes parameter.
Auth0 Terraform Provider version
1.11.0
Terraform version
1.10.3
The text was updated successfully, but these errors were encountered:
Checklist
Description
When running a
terraform plan
/terraform apply
with theauth0_resource_server_scopes
resource,scopes
without adescription
are unexpectedly being destroyed and re-created.This can cause issues when there exists Auth0 Roles that reference those corresponding permissions as terraform destroys the permission that is referenced by the role.
Expectation
If a
scopes
value on aauth0_resource_server_scopes
resource does not change, then terraform should not attempt to modify it.Reproduction
foobar
scope will be destroyed and re-created.I would expect terraform to not show any changes for the
foobar
scope, but rather only show adding thefizzbuzz
scope.Workaround
Adding
description = ""
to the scopes without a description seems to prevent this issue from occuring, which leads me to think there is an issue with a"" != null
check when the terraform plan runs.I think this workaround is not ideal though. It would be better if either the provider correctly handled diffing the scope values when the state contains an empty string but the code contains a
null
value for the description, or if the provider made thedescription
property required (notnull
but still allowing for an empty string) on thescopes
parameter.Auth0 Terraform Provider version
1.11.0
Terraform version
1.10.3
The text was updated successfully, but these errors were encountered: