Hi there,
I am setting up new IaC system and I setup my first Postgres terraform (azurerm) module and it worked fine.
However, the moment, I add a second module (AKS), the providers started throwing constraint errors.
I have child modules sitting in another repo (Postgres & AKS) and calling them from a parent module (main.tf)
I tried to keep the provider version same for both modules and its failing with this error (for sometime actually, I couldn’t get to fix it).
Here is my providers.tf file of parent module
terraform {
required_version = ">=1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "< 4.0.0"
}
azapi = {
source = "azure/azapi"
version = "~>1.5"
}
random = {
source = "hashicorp/random"
version = "~>3.0"
}
azuread = {
source = "hashicorp/azuread"
version = "2.30.0"
}
}
}
provider "azurerm" {
# resource_provider_registrations = true
features {}
use_oidc = true
use_msi = true
}
Here is the providers.tf file from both child modules (Postgres and AKS):
terraform {
required_version = "~> 1.5"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.10"
}
}
}
provider "azurerm" {
# skip_provider_registration = true
features {}
# use_oidc = true
# use_msi = true
}
And the error I am getting is with terraform init
:
Initializing provider plugins…
- Finding hashicorp/azurerm versions matching “>= 3.106.1, < 4.0.0, ~> 4.10, ~> 4.12”…
- Finding azure/azapi versions matching “>= 1.4.0, ~> 1.5, < 2.0.0”…
- Finding hashicorp/random versions matching “~> 3.0, >= 3.3.2, ~> 3.5, ~> 3.6”…
- Finding hashicorp/azuread versions matching “2.30.0”…
- Finding hashicorp/tls versions matching “>= 3.1.0”…
- Finding hashicorp/null versions matching “>= 3.0.0”…
- Finding azure/modtm versions matching “~> 0.3”…
- Installing hashicorp/random v3.6.3…
- Installed hashicorp/random v3.6.3 (signed by HashiCorp)
- Installing hashicorp/azuread v2.30.0…
- Installed hashicorp/azuread v2.30.0 (signed by HashiCorp)
- Installing hashicorp/tls v4.0.6…
- Installed hashicorp/tls v4.0.6 (signed by HashiCorp)
- Installing hashicorp/null v3.2.3…
- Installed hashicorp/null v3.2.3 (signed by HashiCorp)
- Installing azure/modtm v0.3.2…
- Installed azure/modtm v0.3.2 (signed by a HashiCorp partner, key ID 6F0B91BDE98478CF)
- Installing azure/azapi v1.15.0…
- Installed azure/azapi v1.15.0 (signed by a HashiCorp partner, key ID 6F0B91BDE98478CF)
Partner and community providers are signed by their developers.
╷
If you’d like to know more about provider signing, you can read about it here:
│ Error: Failed to query available provider packages
https://www.terraform.io/docs/cli/plugins/signing.html
│
│ Could not retrieve the list of available versions for provider
│ hashicorp/azurerm: no available releases match the given constraints >=
│ 3.106.1, < 4.0.0, ~> 4.10, ~> 4.12
│
│ To see which modules are currently depending on hashicorp/azurerm and what
│ versions are specified, run the following command:
│ terraform providers
╵
Error: Process completed with exit code 1.
What am I missing here?
Cheers!