【发布时间】:2020-12-18 05:06:44
【问题描述】:
文件的terraform代码-“myec2.tf”
provider "aws" {
region = "eu-west-1"
access_key = "<<access key id>>"
secret_key = "<<secret key id>>"
}
# chosen from the RESOURCE section in Terraform 'Provider' section
resource "aws_instance" "terra_ec2" {
ami = "ami-07d9160fa81ccffb5"
instance_type = "t2.micro"
provider = "https://registry.terraform.io/hashicorp/aws"
}
发出“terraform init”命令后得到的ERROR MESSAGES
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.
Warning: Quoted references are deprecated
on first_ec2.tf line 11, in resource "aws_instance" "terra_ec2":
11: provider = "https://registry.terraform.io/hashicorp/aws"
In this context, references are expected literally rather than in quotes.
Terraform 0.11 and earlier required quotes, but quoted references are now
deprecated and will be removed in a future version of Terraform. Remove the
quotes surrounding this reference to silence this warning.
Error: Invalid character
on first_ec2.tf line 11, in resource "aws_instance" "terra_ec2":
11: provider = "https://registry.terraform.io/hashicorp/aws"
预期属性访问或索引运算符。
【问题讨论】:
-
这一次,当我从“资源”块中删除“提供者”时,我得到了这个:初始化后端...正在初始化提供者插件... - 查找最新版本的 hashcorp/aws...错误:无法查询可用提供程序包无法检索提供程序 hashcorp/aws 的可用版本列表:无法连接到 registry.terraform.io:无法请求发现文档:获取“registry.terraform.io/.well-known/terraform.json”:读取 tcp >:51717->>:443: wsarecv: 现有连接被远程主机强行关闭。
标签: terraform terraform-provider-aws