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
Policy value is created in the API and reflected in Terraform state
Actual Behavior
A small percentage of the time (about 5% in my experience, but mostly when doing bulk changes), the policy isn't created in the API, but Terraform believes it has, and it is written to the local state. On the next run, an unexpected number of resolved policies for schema xxxx error is returned as the remote state is fetched via a policies:resolve API call, and an empty dictionary is returned.
Specifically, the state occurs where the policy value previously did not exist (it was inherited), and we're creating it.
Ultimately this is related to an issue with the Chrome Policy API - it should not be returning an HTTP 200 response to a POST if the batchModify didn't actually take place.
However, similar behavior can also occur if a policy value is created by Terraform but then changed to inherited outside of Terraform. Of course, "bad things can occur" can be true if this type of change is done, but this provider already has the wiring to check actual remote state, so it should be able to handle that case and perhaps generate a warning before recreating. If a value is changed outside of Terraform, this provider does have the capability to change it back.
Steps to Reproduce
Apply a bunch of changes at once, 20+ and I fairly consistently ran into the problem, in my case all to the same org unit.
On the next Terraform run, if one of the resources exists in state but isn't resolved to any value, Terraform will error out.
Step 1 can also be replaced by setting a policy value to inherit outside of Terraform.
Terraform Version
1.7.5
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Debug Output
Panic Output
n/a
Expected Behavior
Policy value is created in the API and reflected in Terraform state
Actual Behavior
A small percentage of the time (about 5% in my experience, but mostly when doing bulk changes), the policy isn't created in the API, but Terraform believes it has, and it is written to the local state. On the next run, an
unexpected number of resolved policies for schema xxxx
error is returned as the remote state is fetched via a policies:resolve API call, and an empty dictionary is returned.Specifically, the state occurs where the policy value previously did not exist (it was inherited), and we're creating it.
Ultimately this is related to an issue with the Chrome Policy API - it should not be returning an HTTP 200 response to a POST if the batchModify didn't actually take place.
However, similar behavior can also occur if a policy value is created by Terraform but then changed to inherited outside of Terraform. Of course, "bad things can occur" can be true if this type of change is done, but this provider already has the wiring to check actual remote state, so it should be able to handle that case and perhaps generate a warning before recreating. If a value is changed outside of Terraform, this provider does have the capability to change it back.
Steps to Reproduce
Step 1 can also be replaced by setting a policy value to inherit outside of Terraform.
Important Factoids
This occurs with both the current state of the hashicorp provider, as well as the https://github.com/Yohan460/terraform-provider-googleworkspace fork.
References
The text was updated successfully, but these errors were encountered: