Auth0 Terraform Provider Addons and SSO Differences Persist After Running Terraform Apply
Last Updated:
Overview
When Terraform manages auth0_client resources, terraform plan repeatedly detects differences for addons or Single Sign-On (SSO) that does not resolve after Terraform runs terraform apply. This occurs because the Auth0 Management API retains empty objects or default values that Terraform attempts to clear. Resolve this issue by using the Auth0 Management API to explicitly patch the client with null for addons or false for SSO.
Applies To
- Auth0
- Terraform Provider
- Auth0 Management API
Cause
The Auth0 Management API retains addons as an empty object ({}) or sso as true in the backend, which conflicts with the Terraform state expecting a null or cleared value. Terraform cannot successfully clear these specific fields during an apply operation.
Solution
How are the persistent Terraform differences resolved?
Resolve the persistent differences by sending a PATCH request to the Auth0 Management API to explicitly set the addons and SSO values.
To Resolve the addons Difference
- Send a
PATCHrequest to the/api/v2/clients/<client_id>endpoint withaddonsset tonull. Sending an empty object{}does not resolve the issue. - Run the following cURL command to patch the
addonsfield.curl --request PATCH \ --url 'https://<tenant>.auth0.com/api/v2/clients/<client_id>' \ --header 'authorization: Bearer <access_token>' \ --header 'content-type: application/json' \ --data '{"addons": null}'
To Resolve the sso Difference
- Send a
PATCHrequest to the/api/v2/clients/<client_id>endpoint withssoset tofalse. - Run the following cURL command to patch the
ssofield.curl --request PATCH \ --url 'https://<tenant>.auth0.com/api/v2/clients/<client_id>' \ --header 'authorization: Bearer <access_token>' \ --header 'content-type: application/json' \ --data '{"sso": false}'