Skip to content

Commit 4b2796f

Browse files
committed
wait until for ec2 instance is ready
1 parent a183cb5 commit 4b2796f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

run-ansible-after-ec2-launch-terraform.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ resource "aws_instance" "public_instance" {
7777
provisioner "local-exec" {
7878
command = "touch dynamic_inventory.ini"
7979
}
80+
81+
provisioner "remote-exec" {
82+
inline = [
83+
"echo 'EC2 instance is ready.'"
84+
]
85+
86+
connection {
87+
type = "ssh"
88+
host = self.public_ip
89+
user = "ubuntu"
90+
private_key = tls_private_key.rsa_4096.private_key_pem
91+
}
92+
}
8093
}
8194

8295
data "template_file" "inventory" {

0 commit comments

Comments
 (0)