Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (22 sloc) 718 Bytes
resource "aws_instance" "terraform_instance" {
ami = "${lookup(var.amis, var.region)}"
instance_type = "t2.micro"
key_name = "aws-lab"
connection {
type = "ssh"
user = "ubuntu"
private_key = "${file("/Users/kagarlickij/.ssh/aws-lab.pem")}"
}
provisioner "remote-exec" {
inline = [
"sudo apt-get update -y",
"sudo apt-get install python -y",
]
}
provisioner "local-exec" {
command = "sleep 120; ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u ubuntu --private-key /Users/kagarlickij/.ssh/aws-lab.pem -i '${aws_instance.terraform_instance.public_ip},' install_nginx.yml"
}
}
output "public_ip" {
value = "${aws_eip.terraform_eip.public_ip}"
}
You can’t perform that action at this time.