Updates in Auth0 Dashboard to Resources Managed by Terraform Cause Desynchronization
Last Updated:
Overview
This article addresses an issue where Terraform loses track of Auth0 resources when connected to Auth0 via Machine to Machine (M2M) communication, after modifications are made directly in the Auth0 dashboard. This results in a desynchronization between the Terraform state and the actual configuration in Auth0.
Applies To
-
Auth0
-
Terraform
Cause
When a resource managed by Terraform is modified manually in the Auth0 dashboard, its underlying resource ID can change. Terraform relies on this ID to track the resource's state. When a change occurs outside of Terraform's control, it causes a mismatch between the configuration defined in the code and the actual resource, leading to state drift.
Solution
To avoid state drift, all required updates must be implemented in the Terraform code and applied using the terraform apply command. The .tf files must always be the single source of truth for the infrastructure's configuration.
If state drift has already occurred due to manual changes in the dashboard, resolve it with the following steps:
-
Run
terraform planto see the detected differences. -
Run
terraform apply. This command overwrites any manual modifications and synchronizes the live Auth0 configuration with the code.