{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/3059","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/3059/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/3059/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/3059/events","html_url":"https://github.com/hashicorp/terraform/issues/3059","id":102550782,"number":3059,"title":"Sporadic SSH connection failure with remote-exec","user":{"login":"mprimeaux","id":293512,"avatar_url":"https://avatars.githubusercontent.com/u/293512?v=3","gravatar_id":"","url":"https://api.github.com/users/mprimeaux","html_url":"https://github.com/mprimeaux","followers_url":"https://api.github.com/users/mprimeaux/followers","following_url":"https://api.github.com/users/mprimeaux/following{/other_user}","gists_url":"https://api.github.com/users/mprimeaux/gists{/gist_id}","starred_url":"https://api.github.com/users/mprimeaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mprimeaux/subscriptions","organizations_url":"https://api.github.com/users/mprimeaux/orgs","repos_url":"https://api.github.com/users/mprimeaux/repos","events_url":"https://api.github.com/users/mprimeaux/events{/privacy}","received_events_url":"https://api.github.com/users/mprimeaux/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-22T16:55:21Z","updated_at":"2015-08-22T22:13:43Z","closed_at":"2015-08-22T22:13:43Z","body":"I'm using the AWS provider and have reviewed all Terraform issues related to SSH connectivity failures involving the remote-exec provisioner that I am aware of and have exhausted all avenues based on those conversation threads.\r\n\r\nHere's the exception emitted by Terraform:\r\n\r\n> Error applying plan:\r\n>\r\n> 1 error(s) occurred:\r\n>\r\n> * dial tcp 52.19.120.112:22: i/o timeout\r\n> ...\r\n\r\nAs I mention in the title, the timeout occurs **sporadically**.  To provide a bit of context, I'm using the latest released version of Terraform. We create machine (EC2) clusters of varying sizes. Each cluster is is associated with the same, newly created, VPC. The VPC currently has a single NAT subnet that does route through an internet-accessible gateway. All of this is of course hosted in Amazon.\r\n\r\nHere are the pseudo-steps:\r\n\r\n1. Create a VPC\r\n2. Create an internet gateway associated with the VPC created in step 1.\r\n3. Create a public subnet (map_public_ip_on_launch = true) associated with the VPC created in step 1.\r\n4. Create a routing table associated with the VPC created in step 1.\r\n5. Create a routing table association between the subnet (step 3) and the routing table (step 4).\r\n6. Create a security group associated with the VPC created in step 1.\r\n7. Create an EC2 instance associated to the security group created in step 6 and with associate_public_ip_address = true. The remote-exec provisioner associated with this instance is the one that times out.\r\n\r\nAny help is greatly appreciated."},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/133758832","html_url":"https://github.com/hashicorp/terraform/issues/3059#issuecomment-133758832","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/3059","id":133758832,"user":{"login":"mprimeaux","id":293512,"avatar_url":"https://avatars.githubusercontent.com/u/293512?v=3","gravatar_id":"","url":"https://api.github.com/users/mprimeaux","html_url":"https://github.com/mprimeaux","followers_url":"https://api.github.com/users/mprimeaux/followers","following_url":"https://api.github.com/users/mprimeaux/following{/other_user}","gists_url":"https://api.github.com/users/mprimeaux/gists{/gist_id}","starred_url":"https://api.github.com/users/mprimeaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mprimeaux/subscriptions","organizations_url":"https://api.github.com/users/mprimeaux/orgs","repos_url":"https://api.github.com/users/mprimeaux/repos","events_url":"https://api.github.com/users/mprimeaux/events{/privacy}","received_events_url":"https://api.github.com/users/mprimeaux/received_events","type":"User","site_admin":false},"created_at":"2015-08-22T22:13:43Z","updated_at":"2015-08-22T22:13:43Z","body":"Perhaps I'm being cautiously optimistic but I consider this matter solved.  I ended up needing to use the [aws_main_route_table_association](https://terraform.io/docs/providers/aws/r/main_route_table_assoc.html) resource to ensure consistent connectivity between the public internet (me) and each node of the cluster. "}}