Skip to content

configuration_aliases throws misleading error in 0.14.x even though required_version = ">= 0.15" #29109

@grimm26

Description

@grimm26

Terraform Version

Terraform v0.14.11

Terraform Configuration Files

terraform {
  required_version = ">= 0.15"
  required_providers {
    aws = {
      source                = "hashicorp/aws"
      version               = ">= 3.40"
      configuration_aliases = [aws.this]
    }
  }
}

Expected Behavior

Throw the error for unsupported terraform core version first thing on a terraform init. This should be the first thing checked because if there is a required version, chances are that a non-supported version is going to have features that will look like errors.

Actual Behavior

$ terraform init

There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Error: Invalid required_providers object

  on versions.tf line 4, in terraform:
   4:     aws = {
   5:       source                = "hashicorp/aws"
   6:       version               = ">= 3.40"
   7:       configuration_aliases = [aws.this]
   8:     }

required_providers objects can only contain "version" and "source" attributes.
To configure a provider, use a "provider" block.


Error: Variables not allowed

  on versions.tf line 7, in terraform:
   7:       configuration_aliases = [aws.this]

Variables may not be used here.

Steps to Reproduce

  1. terraform init

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconfigexplaineda Terraform Core team member has described the root cause of this issue in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions