{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/3769","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/3769/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/3769/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/3769/events","html_url":"https://github.com/hashicorp/terraform/issues/3769","id":115309788,"number":3769,"title":"Chef provisioner not installing chef on Windows","user":{"login":"bsharitt","id":181060,"avatar_url":"https://avatars.githubusercontent.com/u/181060?v=3","gravatar_id":"","url":"https://api.github.com/users/bsharitt","html_url":"https://github.com/bsharitt","followers_url":"https://api.github.com/users/bsharitt/followers","following_url":"https://api.github.com/users/bsharitt/following{/other_user}","gists_url":"https://api.github.com/users/bsharitt/gists{/gist_id}","starred_url":"https://api.github.com/users/bsharitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsharitt/subscriptions","organizations_url":"https://api.github.com/users/bsharitt/orgs","repos_url":"https://api.github.com/users/bsharitt/repos","events_url":"https://api.github.com/users/bsharitt/events{/privacy}","received_events_url":"https://api.github.com/users/bsharitt/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/chef","name":"provisioner/chef","color":"bfd4f2"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-05T15:37:14Z","updated_at":"2015-11-11T17:02:26Z","closed_at":null,"body":"When ever running the chef provisioner against a Windows box(Windows 2008 R2 running on AWS EC2) the chef client run fails:\r\n\r\n```\r\naws_instance.winwhef2-haarp-1 (chef): Connected!\r\naws_instance.winwhef2-haarp-1 (chef): Downloading Chef Client...\r\naws_instance.winwhef2-haarp-1 (chef): Installing Chef Client...\r\naws_instance.winwhef2-haarp-1 (chef): Creating configuration files...\r\naws_instance.winwhef2-haarp-1 (chef): Starting initial Chef-Client run...\r\naws_instance.winwhef2-haarp-1 (chef): 'chef-client' is not recognized as an internal or external command,\r\naws_instance.winwhef2-haarp-1 (chef): operable program or batch file.\r\n```\r\nWhen logging in the the Windows instance, chef client is not installed but the client.rb, first-boot.json, and validation.pem in C:\\chef are there. The installer script to install chef are in C:\\Temp and when I got back to manually run it, it works and installs chef-client. What I've posted above is exactly the output I get from terraform run, so there's indication that a the chef client install may have failed."},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/155847167","html_url":"https://github.com/hashicorp/terraform/issues/3769#issuecomment-155847167","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/3769","id":155847167,"user":{"login":"bsharitt","id":181060,"avatar_url":"https://avatars.githubusercontent.com/u/181060?v=3","gravatar_id":"","url":"https://api.github.com/users/bsharitt","html_url":"https://github.com/bsharitt","followers_url":"https://api.github.com/users/bsharitt/followers","following_url":"https://api.github.com/users/bsharitt/following{/other_user}","gists_url":"https://api.github.com/users/bsharitt/gists{/gist_id}","starred_url":"https://api.github.com/users/bsharitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsharitt/subscriptions","organizations_url":"https://api.github.com/users/bsharitt/orgs","repos_url":"https://api.github.com/users/bsharitt/repos","events_url":"https://api.github.com/users/bsharitt/events{/privacy}","received_events_url":"https://api.github.com/users/bsharitt/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T17:02:26Z","updated_at":"2015-11-11T17:02:26Z","body":"I think I've got the root cause the issue figured out. It seems that terraform is simply kicking off the chef run before Windows is fully up(despite being able to connect). I was able to work around the issue by putting a 2 minute sleep in between terraform being able to connect to the machine and it actually running chef.\r\n\r\n```\r\nprovisioner \"remote-exec\" {\r\n  inline = [\r\n    \"hostname\"\r\n  ]\r\n  connection {\r\n    type = \"winrm\"\r\n    user = \"Administrator\"\r\n    password = \r\n  }\r\n}\r\nprovisioner \"local-exec\" {\r\n  command = \"sleep 2m\"\r\n}\r\nprovisioner \"chef\"  {\r\n```"}}