Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Adding resource which will wait for VMs to be ssh reachable
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzickap committed Jan 28, 2019
1 parent ce6f336 commit d403ab8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions terrafrom/openstack/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ resource "openstack_compute_floatingip_associate_v2" "floatingip-associate" {
instance_id = "${element(openstack_compute_instance_v2.vms.*.id, count.index)}"
}

# Wait for VMs to be fully up (accessible by ssh)
resource "null_resource" "vms" {
count = "${var.vm_nodes * var.environment_count}"
depends_on = ["openstack_compute_floatingip_associate_v2.floatingip-associate"]

connection {
type = "ssh"
host = "${element(openstack_networking_floatingip_v2.floatingip.*.address, count.index)}"
#private_key = "${file("~/.ssh/id_rsa")}"
user = "${var.username}"
agent = true
}
provisioner "remote-exec" {
inline = [ ]
}
}

output "vms_name" {
value = "${openstack_compute_instance_v2.vms.*.name}"
}
Expand Down

0 comments on commit d403ab8

Please sign in to comment.