Issue with provider constraint with multiple modules

Hi there,
I am pulling two modules (for AKS) and they both have different azurerm provider versions:
Postgres (~> 4.12)
AKS (>= 3.106.1, < 4.0)

I added the same in my providers.tf file:

terraform {
  required_version = "~> 1.9"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 3.106.1, < 4.0, ~> 4.12"
    }

And a simple terraform init is throwing the error:

- Installed hashicorp/azuread v2.30.0 (signed by HashiCorp)
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:
https://www.terraform.io/docs/cli/plugins/signing.html
│ Error: Failed to query available provider packages
│ 
│ 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.0, ~> 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.

How can I fix this multi provider version constraint? Any inputs folks :raising_hand_man:t2:

Hi @un_user,

The two modules shown have conflicting provide requirements, so they cannot be used in the same configuration. If you wish to use these modules, you will have to use them from independent configs.

Appreciate the response here @jbardin . Yeah I figured out little late on the bugs these Azure modules pose and how terraform provider constraint works.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.