Terraform Provider "Error: 404 Not Found: The connection does not exist"

Overview

When using the auth0_connection_clients resource to enable applications on a connection, the following error is observed:

Error: 404 Not Found: The connection does not exist

Applies To

  • Terraform
  • Auth0 Connections

Cause

Possible causes:

  1. A mismatch between the local and remote state. For example, if the connection was deleted in Auth0 after it was previously created using Terraform.
  2. The auth0_connection resource uses a different provider pointing to a different tenant. The result is that the auth0_connection resources exist in another tenant but not the one under which the auth0_connection_clients will be applied.

Solution

A. If due to a mismatch between local and remote state, either:

  1. Delete the connection in Auth0 and rerun terraform apply to create a new connection and update the state with its new ID.
    or
  2. Modify the existing Terraform state or revert to a previous version if available so that the ID of the auth0_connection resource matches the ID of the connection in Auth0.

B. If due to the auth0_connection resource being under a different provider, depending on the configuration, either set an explicit provider alias in the resource block or remove the existing alias so it uses the default auth0 provider.