{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/4022","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/4022/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/4022/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/4022/events","html_url":"https://github.com/hashicorp/terraform/issues/4022","id":118398944,"number":4022,"title":"remote-exec provisioner fails with \"Error reading script: EOF\" (Terraform v0.6.6) (target atomic)","user":{"login":"richard-mauri","id":15126243,"avatar_url":"https://avatars.githubusercontent.com/u/15126243?v=3","gravatar_id":"","url":"https://api.github.com/users/richard-mauri","html_url":"https://github.com/richard-mauri","followers_url":"https://api.github.com/users/richard-mauri/followers","following_url":"https://api.github.com/users/richard-mauri/following{/other_user}","gists_url":"https://api.github.com/users/richard-mauri/gists{/gist_id}","starred_url":"https://api.github.com/users/richard-mauri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richard-mauri/subscriptions","organizations_url":"https://api.github.com/users/richard-mauri/orgs","repos_url":"https://api.github.com/users/richard-mauri/repos","events_url":"https://api.github.com/users/richard-mauri/events{/privacy}","received_events_url":"https://api.github.com/users/richard-mauri/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/provisioner/remote-exec","name":"provisioner/remote-exec","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-11-23T14:59:15Z","updated_at":"2016-06-16T21:22:03Z","closed_at":null,"body":"I have a tf file that provisions an aws instance and then uses a file provisioner to upload a file and then a remote-exec provisioner to perform a simple command. The file provisioner works. The remote-exec takes a couple minutes and then fails with an EOF error.\r\n\r\n\r\n---------------------------------\r\n[ec2-user@ip-172-31-22-157 atomic]$ terraform apply\r\naws_instance.atomic-server: Creating...\r\n  ami:                        \"\" => \"ami-35859254\"\r\n  availability_zone:          \"\" => \"<computed>\"\r\n  ebs_block_device.#:         \"\" => \"<computed>\"\r\n  ephemeral_block_device.#:   \"\" => \"<computed>\"\r\n  instance_type:              \"\" => \"m3.medium\"\r\n  key_name:                   \"\" => \"devops1\"\r\n  placement_group:            \"\" => \"<computed>\"\r\n  private_dns:                \"\" => \"<computed>\"\r\n  private_ip:                 \"\" => \"<computed>\"\r\n  public_dns:                 \"\" => \"<computed>\"\r\n  public_ip:                  \"\" => \"<computed>\"\r\n  root_block_device.#:        \"\" => \"<computed>\"\r\n  security_groups.#:          \"\" => \"1\"\r\n  security_groups.2585437983: \"\" => \"wideopen\"\r\n  source_dest_check:          \"\" => \"1\"\r\n  subnet_id:                  \"\" => \"<computed>\"\r\n  tags.#:                     \"\" => \"1\"\r\n  tags.Name:                  \"\" => \"atomic-0\"\r\n  tenancy:                    \"\" => \"<computed>\"\r\n  vpc_security_group_ids.#:   \"\" => \"<computed>\"\r\naws_instance.atomic-server: Provisioning with 'file'...\r\naws_instance.atomic-server: Provisioning with 'file'...\r\naws_instance.atomic-server: Provisioning with 'remote-exec'...\r\naws_instance.atomic-server (remote-exec): Connecting to remote host via SSH...\r\naws_instance.atomic-server (remote-exec):   Host: 52.10.122.243\r\naws_instance.atomic-server (remote-exec):   User: fedora\r\naws_instance.atomic-server (remote-exec):   Password: false\r\naws_instance.atomic-server (remote-exec):   Private key: true\r\naws_instance.atomic-server (remote-exec):   SSH Agent: false\r\naws_instance.atomic-server (remote-exec): Connected!\r\nError applying plan:\r\n\r\n1 error(s) occurred:\r\n\r\n* Failed to upload script: Error reading script: EOF\r\n\r\nTerraform does not automatically rollback in the face of errors.\r\nInstead, your Terraform state file has been partially updated with\r\nany resources that successfully completed. Please address the error\r\nabove and apply again to incrementally change your infrastructure.\r\n\r\n---------------------------------\r\nBelow is the relevant portion of my .tf file\r\n\r\n    provisioner \"file\" {\r\n        source = \"fedora_bashrc\"\r\n        destination  = \"/home/fedora/fedora_bashrc\"\r\n    }\r\n    provisioner \"remote-exec\" {\r\n        inline = [\r\n            \"cat /home/fedora/fedora_bashrc >> /home/fedora/.bashrc\",\r\n        ]\r\n    }\r\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/226617700","html_url":"https://github.com/hashicorp/terraform/issues/4022#issuecomment-226617700","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/4022","id":226617700,"user":{"login":"boyvanduuren","id":4145582,"avatar_url":"https://avatars.githubusercontent.com/u/4145582?v=3","gravatar_id":"","url":"https://api.github.com/users/boyvanduuren","html_url":"https://github.com/boyvanduuren","followers_url":"https://api.github.com/users/boyvanduuren/followers","following_url":"https://api.github.com/users/boyvanduuren/following{/other_user}","gists_url":"https://api.github.com/users/boyvanduuren/gists{/gist_id}","starred_url":"https://api.github.com/users/boyvanduuren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boyvanduuren/subscriptions","organizations_url":"https://api.github.com/users/boyvanduuren/orgs","repos_url":"https://api.github.com/users/boyvanduuren/repos","events_url":"https://api.github.com/users/boyvanduuren/events{/privacy}","received_events_url":"https://api.github.com/users/boyvanduuren/received_events","type":"User","site_admin":false},"created_at":"2016-06-16T21:22:03Z","updated_at":"2016-06-16T21:22:03Z","body":"I'm running into this same issue as well using the AWS Linux AMI.\r\nJust now I quickly hacked together a fix that iterates over the `inline` array and executes each string as a command over SSH.\r\nLet me know if that's an acceptable way to do this. If so, I might be able to write a proper fix somewhere next week."}}
{"actor":{"display_login":"boyvanduuren"}}