how to make terraform wait before making connection

805 views
Skip to first unread message

Lian Jiang

unread,
May 18, 2015, 3:02:55 PM5/18/15
to terrafo...@googlegroups.com
I am using winrm to remote-exec on aws windows instance:

 provisioner "remote-exec" {
    script = "PrepareWindows.cmd"
    connection {
      type = "winrm"
      user = "administrator"
      password = "${var.adminPassword}"
    }
  }

The script returns error: dial tcp 52.8.100.117:5985: operation timed out. I have confirmed that the password is correct.

I guess it is because the windows vm need long time to initialize and terraform need to wait before making the connection.

How to make terraform wait? Thanks for any clue.

Lian Jiang

unread,
May 18, 2015, 3:26:09 PM5/18/15
to terrafo...@googlegroups.com
Just saw timeout setting. I will play with it. Thanks.

Lian Jiang

unread,
May 18, 2015, 4:52:44 PM5/18/15
to terrafo...@googlegroups.com
Looks like for my dev box to connect to the windows instance in aws created by "terraform apply", terraform running on my dev box need to use winrm over https. However, the https cert is bound to the windows instance name which can only be created after this windows instance has been created. So there is no way to get the https cacert required by winrm provisioner when running "terraform apply". 

Can anybody help me understand how winrm work for my scenario (running scripts remotely on an aws windows instance from my dev box in my company network during "terraform apply")?

Thanks for any help.

Sander van Harmelen

unread,
May 18, 2015, 5:28:22 PM5/18/15
to Lian Jiang, terrafo...@googlegroups.com
Not much time to help today, but indeed WinRM and certs are a pain. No change to use AMI's that have WinRM configured to accept plain HTTP connections? That would be the easies and fastest way forward I guess.

Sander
--
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To post to this group, send email to terrafo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/38604117-2ad1-4135-9186-a9df9c159927%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages