Terraform:找不到供应商
Terraform: provisioner couldn't be found
我的 .tf 文件 中有 resource "aws_instance" "webserver"
,其中包含 provisioner "install-apache"
:
provider "aws" {
access_key = "ACCESS_KEY"
secret_key = "SECRET-KEY"
region = "us-east-1"
}
resource "aws_instance" "webserver" {
ami = "ami-b374d5a5"
instance_type = "t2.micro"
provisioner "install-apache" {
command = "apt-get install nginx"
}
}
在 运行 terraform plan
之后出现错误:
* aws_instance.webserver: provisioner install-apache couldn't be found
根据 terraform documentation 看来一切正常。
provisioner 值必须是以下之一:
- 厨师
- 文件
- 本地执行
- 远程执行
我相信在你的情况下你想要 remote-exec
值
provider "aws" {
access_key = "ACCESS_KEY"
secret_key = "SECRET-KEY"
region = "us-east-1"
}
resource "aws_instance" "webserver" {
ami = "ami-b374d5a5"
instance_type = "t2.micro"
provisioner "remote-exec" {
inline = [
"apt-get install nginx"
]
}
}
我的 .tf 文件 中有 resource "aws_instance" "webserver"
,其中包含 provisioner "install-apache"
:
provider "aws" {
access_key = "ACCESS_KEY"
secret_key = "SECRET-KEY"
region = "us-east-1"
}
resource "aws_instance" "webserver" {
ami = "ami-b374d5a5"
instance_type = "t2.micro"
provisioner "install-apache" {
command = "apt-get install nginx"
}
}
在 运行 terraform plan
之后出现错误:
* aws_instance.webserver: provisioner install-apache couldn't be found
根据 terraform documentation 看来一切正常。
provisioner 值必须是以下之一:
- 厨师
- 文件
- 本地执行
- 远程执行
我相信在你的情况下你想要 remote-exec
值
provider "aws" {
access_key = "ACCESS_KEY"
secret_key = "SECRET-KEY"
region = "us-east-1"
}
resource "aws_instance" "webserver" {
ami = "ami-b374d5a5"
instance_type = "t2.micro"
provisioner "remote-exec" {
inline = [
"apt-get install nginx"
]
}
}