terraform with provisioner
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
resource "aws_instance" "godwin" {
ami = "ami-03d5c68bab01f3496"
instance_type = "t2.micro"
key_name-"godwin_key"
connection {
type = "ssh"
user = "ubuntu"
private_key = file("godwin_key.pem")
#host = aws_instance.web.public_ip
host = self.public_ip
}
provisioner "file" {
source = "playbook.yml"
destination = "/tmp/"
}
provisioner "remote-exec" {
inline = [
"sudo apt-get update",
"sudo apt install software-properties-common",
"sudo add-apt-repository --yes --update ppa:ansible/ansible",
"sudo apt install ansible -y",
"ansible-playbook playbook.yml --check",
]
}
}