terraform validate execution falied
Closed this issue · 6 comments
provider "aws" {
region="us-west-2"
access_key=""
secret_key=""
}
resource"aws_instance" "apache"{
ami="ami-005bdb005fb00e791"
key_name="terr1"
instance_type="t2.micro"
security_key=["launch-wizard-1"]
connection{
type="ssh"
user="ec2-user"
private_key="${file("./terr1.pem")}"
}
provisioner "remote_exec"{
inline=[ "sudo yum install httpd -y","sudo service httpd start"]
}
}
error issue:
PS D:\practice\mainterraform> terraform validate .
Error: aws_instance.apache: provisioner remote_exec couldn't be found
PS D:\practice\mainterraform>
provider "aws" {
region="us-west-2"
access_key=""
secret_key=""
}
resource"aws_instance" "apache"{
ami="ami-005bdb005fb00e791"
key_name="terr1"
instance_type="t2.micro"
security_key=["launch-wizard-1"]
connection{
type="ssh"
user="ec2-user"
private_key="${file("./terr1.pem")}"
}
provisioner "remote_exec"{
inline=[ "sudo yum install httpd -y","sudo service httpd start"]
}
}
your machine ubuntu but you write a script for centos
provider "aws" {
region="us-west-2"
access_key=""
secret_key=""
}
resource"aws_instance" "apache"{
ami="ami-005bdb005fb00e791"
key_name="terr1"
instance_type="t2.micro"
security_key=["launch-wizard-1"]
connection{
type="ssh"
user="ec2-user"
private_key="${file("./terr1.pem")}"
}
provisioner "remote_exec"{
inline=[ "sudo apt-get install apache2 -y",]
}
}
after change done in the script to Ubuntu the same issue is occurred.
Error: aws_instance.apache: provisioner remote_exec couldn't be found
hello maredupaka, please follow this
provider "aws" {
region="us-west-2"
access_key=""
secret_key=""
}
resource"aws_instance" "apache"{
ami="ami-005bdb005fb00e791"
key_name="hi"
instance_type="t2.micro"
security_groups=["hello"]
connection{
type="ssh"
user="ubuntu"
private_key="${file("./hi.pem")}"
}
provisioner "remote-exec" {
inline = ["sudo apt-get update"
]
}
}
if you get a solution
please close issue
try manually any script if the script works and after doing automation
ok fine code is executing