asquarezone/DevOpsClassRoom

Terraform_execution went wrong

Closed this issue · 0 comments

Hi guys
please have a look my code below

provider "aws" {
region = "us-east-1"
access_key = "" I removed it for not to disclosed
secret_key = ""

resource "aws_instance" "apache" {
instance_type = "t2.micro"
ami = "ami-00e782930f1c3dbc7"
security_groups = ["terraform_vpc"]

connection {
type = "ssh"
user = "ec2_user"
lag_id = "${file("./credentials1")}"
}
}
provisioner "remote-exec" {
inline = [
"sudo yum install httpd -y", "sudo service httpd start",]
}
}

I run this code using PowerShell while following below steps

  1. terraform init .
  2. terraform validate .
  3. terraform apply .
  • while applying it's showing apply complete! resources: 0 added, 0 changed, 0 destroyed.
    it's not installed apache.
    I think I wrote wrong script please help me out here

thanks
kishore