错误:提供程序配置别名无效 [英] Error: Invalid provider configuration alias

查看:15
本文介绍了错误:提供程序配置别名无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

升级到 Terraform v0.12.0 版本并使用terraform 0.12upgrade"更新配置后

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

我收到以下 terraform init 错误

I get error below for terraform init

别名设置为 main.tf 中的变量,并从 azure 传入或替换.

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.

Terraform 配置必须在初始化之前有效,因此Terraform 可以确定需要哪些模块和提供程序已安装.

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}"
}`"

推荐答案

您在提供的提供程序代码中犯了一些错误.代码应更改如下:

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}"  
}

您似乎使用 Azure Provider: Authenticating using the Azure CLI.当你想引用已经设置的变量时,你需要使用像 "${var.var_name}" 这样的代码.

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.

这篇关于错误:提供程序配置别名无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆