1
votes

After upgrade to version Terraform v0.12.0 and updating config using "terraform 0.12upgrade"

I get error below for terraform init

the alias are set to variables in main.tf and are passed in from azure or substituted.

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 provider configuration alias

An alias must be a valid name. A name must start with a letter and may contain only letters, digits, underscores, and dashes.

 `provider "azurerm {
  subscription_id = var.arm_subscription_id
  tenant_id       = var.tenant_id
  alias           = "$${var.myservers_name}"
}`"
1

1 Answers

0
votes

There are some mistakes that you made in the provider code that you provided. The code should change like below:

provider "azurerm" {

  version = ">=1.2.0"
  alias = "${var.alias_name}"

  subscription_id = "${var.arm_subscription_id}"
  tenant_id       = "${var.tenant_id}"  
}

It seems you use the Azure Provider: Authenticating using the Azure CLI. You need to use the code like "${var.var_name}" when you want to quote the variables that set already.