Terraform won't exit after completion

234 views
Skip to first unread message

Stephen Knight

unread,
Sep 29, 2015, 3:07:11 AM9/29/15
to Terraform
Hi Guys,

I'm using Terraform with the vSphere provider: https://github.com/rakutentech/terraform-provider-vsphere

My jobs run successfully, however when they're finished (machines are provisioned, IP's listening etc.) - Terraform just stays running, doing nothing but just running. Am I missing something? Is there an exit 0 or similar I can add to ensure it finishes and cleans up when done?

Thanks
Stephen

PD

unread,
Sep 29, 2015, 2:09:31 PM9/29/15
to Terraform
Not sure if this information is useful for you but I too faced similar problem while using "remote-exec" provisioner, terraform would not exit even after finishing the execution of commands listed in "remote-exec" resource, i added sleep command at the end of the command list and that did the trick.

provisioner "remote-exec" {
    connection {
        user = "${var.ssh_username}"
        #host = "${self.access_ip_v4}"
        key_file = "${var.ssh_keyfile}"
        password = "${var.ssh_password}"
    }
    inline = [
       "consul agent -data-dir /tmp/consul -join ${var.consul_server_ip} &",
       "sleep 1"
        ]
  }

thanks
PD
Reply all
Reply to author
Forward
0 new messages