Auth0 Terraform Provider Addons and SSO Differences Persist After Running Terraform Apply

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

  1. Send a PATCH request to the /api/v2/clients/<client_id> endpoint with addons set to null. Sending an empty object {} does not resolve the issue.
  2. Run the following cURL command to patch the addons field.
    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

  1. Send a PATCH request to the /api/v2/clients/<client_id> endpoint with sso set to false.
  2. Run the following cURL command to patch the sso field.
    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}'

Recommended content

No recommended content found...