{"action":"opened","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/18117","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/18117/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/18117/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/18117/events","html_url":"https://github.com/hashicorp/terraform/issues/18117","id":326108684,"number":18117,"title":"Chef povisioner fails while provisioning instances - knife vault remove","user":{"login":"aknarts","id":252905,"avatar_url":"https://avatars3.githubusercontent.com/u/252905?v=4","gravatar_id":"","url":"https://api.github.com/users/aknarts","html_url":"https://github.com/aknarts","followers_url":"https://api.github.com/users/aknarts/followers","following_url":"https://api.github.com/users/aknarts/following{/other_user}","gists_url":"https://api.github.com/users/aknarts/gists{/gist_id}","starred_url":"https://api.github.com/users/aknarts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aknarts/subscriptions","organizations_url":"https://api.github.com/users/aknarts/orgs","repos_url":"https://api.github.com/users/aknarts/repos","events_url":"https://api.github.com/users/aknarts/events{/privacy}","received_events_url":"https://api.github.com/users/aknarts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-24T12:54:31Z","updated_at":"2018-05-24T12:54:31Z","closed_at":null,"author_association":"NONE","body":"\r\n\r\n<!--\r\nHi there,\r\n\r\nThank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.\r\n\r\nIf your issue relates to a specific Terraform provider, please open it in the provider's own repository. The index of providers is at https://github.com/terraform-providers .\r\n-->\r\n\r\n### Terraform Version\r\n```\r\nTerraform v0.11.6\r\n+ provider.aws v1.14.0\r\n+ provider.null v1.0.0\r\n```\r\n\r\n### Terraform Configuration Files\r\n```hcl\r\nresource \"null_resource\" \"server-provisioner\" {\r\n  count      = \"${aws_instance.server.count}\"\r\n  depends_on = [\"aws_volume_attachment.server-data\"]\r\n\r\n  provisioner \"chef\" {\r\n    environment     = \"${var.chef[\"environment\"]}\"\r\n    server_url      = \"${var.chef[\"ext_server_url\"]}\"\r\n    version         = \"${var.chef[\"version\"]}\"\r\n    user_name       = \"${var.chef[\"user_name\"]}\"\r\n    user_key        = \"${file(\"${var.chef[\"key_path\"]}\")}\"\r\n    node_name       = \"${aws_instance.server.*.tags.Name[count.index]}\"\r\n    recreate_client = true\r\n    ohai_hints      = [\"ec2.json\"]\r\n\r\n    run_list = [\r\n      \"role[base]\",\r\n    ]\r\n\r\n    attributes_json = \"${var.server_attributes_json}\"\r\n\r\n    vault_json = \"${var.server_vault_json}\"\r\n\r\n    connection {\r\n      host         = \"${aws_instance.server.*.private_ip[count.index]}\"\r\n      user         = \"${var.server_ami[\"user\"]}\"\r\n      bastion_host = \"${var.chef[\"bastion_host\"]}\"\r\n      bastion_user = \"${var.chef[\"user_name\"]}\"\r\n    }\r\n  }\r\n\r\n  triggers {\r\n    instance = \"${aws_instance.server.*.id[count.index]}\"\r\n  }\r\n}\r\n```\r\n\r\n### Expected Behavior\r\nNode gets created\r\n\r\n### Actual Behavior\r\n`* module.server.null_resource.provisioner[0]: error executing \"sudo knife vault remove users aws -C \\\"server.example.com\\\" -M client -c /etc/chef/client.rb -u terraform --key /etc/chef/terraform.pem\": wait: remote command exited without exit status or exit signal`\r\n\r\n### Additional Context\r\nI think there is a missing condition here: https://github.com/hashicorp/terraform/blob/master/builtin/provisioners/chef/resource_provisioner.go#L583\r\n\r\nThat block of code gets run even if there was no node with such name present previously\r\n\r\nSaving if it is actual recreation from before(https://github.com/hashicorp/terraform/blob/master/builtin/provisioners/chef/resource_provisioner.go#L528) would probably help the issue\r\n\r\nThis happens to us on new instances and when recreating instances where the name changed\r\n"}}
{"actor":{"display_login":"aknarts"}}