Auth0 Failed to Query Available Provider Packages Error Occurs During Terraform Init
Last Updated:
Overview
Terraform generates a provider package error when initializing an Auth0 project. This occurs because the referenced Terraform provider in the auto-generated configuration file lacks a mapping in a specific child module. Explicitly declare the Auth0 provider within the child module to resolve the issue.
Applies To
- Auth0
- Terraform Provider
Cause
The error occurs because Terraform enforces provider requirements on a strictly per-module basis. When an auto-generated configuration file resides in a subdirectory or another module uses Auth0 resources without an explicit auth0/auth0 mapping, Terraform defaults to assuming the provider is maintained by <provider_name>/auth0.
Solution
To resolve the provider package error, identify the module requesting the incorrect provider and explicitly declare the Auth0 provider within that directory by following these steps:
- Run the
terraform providerscommand in the terminal. - Review the output to identify the specific child module requesting the incorrect
<provider_name>/auth0provider. - Create a
versions.tffile inside the identified child module folder. - Enter the following configuration block into the file to explicitly map the Auth0 provider.
terraform {
required_providers {
auth0 = {
source = "auth0/auth0"
version = ">= 1.0.0" # or <specific_version>
}
}
}
- Run the
terraform initcommand again to initialize the project successfully.