Configuration_aliases within module results in "Variables may not be used here." when alias name is unquoted

Hello,

I am trying to pass aws alias configuration down into a module, where in the module it’s specified like this:

terraform {
  required_version = ">= 0.12"
  
  required_providers {
    pagerduty = {
      source  = "PagerDuty/pagerduty"
      version = "~> 1.9.4"
    }

    aws = {
      source = "hashicorp/aws"
      // Relaxed version constraint to avoid multi-version requirements issues
      version = ">= 2.0.0"
      configuration_aliases = [ aws.platform ]
    }
  }
}

When trying to plan this configuration (with TF-12.x or TF-13.x, doesn’t really matter), I get an error:

Variables may not be used here.

Although the sole Terraform documentation prescribe such usage, see Providers Within Modules - Configuration Language - Terraform by HashiCorp (in the end of the section, right before the next section starts).

Obviously, quoting the value results in provider configuration not been passed properly into the module…

Am I doing something wrong, or is it a bug with the Terraform / AWS Provider?

Thank you!

1 Like

I am having the same issue here.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 2.7.0"
      configuration_aliases = [ aws.useast1, aws.useast2 ]
    }
  }
}

+1.
I thought i’m fairly resourceful when it comes to terraform, but lately all these new versions popping up every 2 seconds, and the tons of changes are confusing the hell out of me. Not to mention, that you cannot switch to documentation for older versions on the website anymore…

Btw, if you switch to version 0.15, the error disappears. although it didn’t solve my original problem…

Installing version 0.15.1 of terraform fixes
BR,
Boran