Terraform provisioner with ansible :

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

resource "aws_instance" "judith-ec2" {
  ami           = "ami-03d5c68bab01f3496" # us-west-2
  instance_type = "t2.micro"
  key_name 		= "judith7"
  tags = {
    Name = "judith inst"
  }
  
  connection {
      type     = "ssh"
      user     = "ubuntu"
      private_key = file("judith7.pem")
      #host = aws_instance.web.public_ip
      host = self.public_ip
  }

  provisioner "local-exec" {
    command = "touch devopsschool-local"
  }
  
  provisioner "remote-exec" {
    inline = [
      "sudo apt-get update",
      "sudo apt-get install wget -y",

      
      ]
  }
  
  provisioner "file" {
    source      = "terraform.tfstate.backup"
    destination = "/tmp/"
  } 
}