小编use*_*972的帖子

使用 terraform 连接运行 aws 实例

resource "aws_instance" "appserver1" {
  ami             = var.imageid
  instance_type   = var.instancetype
  key_name        = var.key
  security_groups = [aws_security_group.allow_all.name]

  connection {
    user        = "ubuntu"
    private_key = file(var.privatekeypath)
  }

  provisioner "remote-exec" {
    inline = [
      "sudo apt-get update",
      "sudo apt-get install tomcat7 -y"
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

“terraform validate”给了我错误:

错误:缺少必需的参数

在 main.tf 第 52 行,资源“aws_instance”“appserver1”中:52:连接{

参数“host”是必需的,但未找到定义。

amazon-web-services terraform devops

2
推荐指数
1
解决办法
2983
查看次数

标签 统计

amazon-web-services ×1

devops ×1

terraform ×1