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”是必需的,但未找到定义。