Auth0 Terraform Provider Shows Constant Drift For Action Secrets
Last Updated:
Overview
The Auth0 Terraform provider continuously reports state changes for action secrets because the Auth0 API masks secret values during retrieval. Adding a lifecycle block to ignore changes for the secrets attribute resolves this issue. Running the terraform plan command constantly reports state drift for auth0_action resources containing secret environment variables, even when no modifications exist.
Applies To
- Auth0
- Auth0 Terraform Provider
- Auth0 Actions
Cause
The Auth0 API masks secret values for security reasons during GET requests. This behavior causes Terraform to read the secret as empty and detect a state drift between the local configuration and the remote state.
Solution
What resolves the constant state drift for action secrets?
Prevent Terraform from detecting false state changes by adding a lifecycle block that ignores the secrets attribute within the action resource configuration.
- Open the Terraform configuration file containing the
auth0_actionresource. - Add a
lifecycleblock inside the resource definition. - Specify the
secretsattribute within theignore_changeslist. - Save the configuration and run the
terraform plancommand to verify the resolution.
resource "auth0_action" "example_action" {
name = "Example Action"
# other configuration...
lifecycle {
ignore_changes = [
secrets
]
}
}