{"action":"created","comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/comments/219529344","pull_request_review_id":157732303,"id":219529344,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTUyOTM0NA==","diff_hunk":"@@ -628,13 +625,20 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err\n \t// Set the region\n \td.Set(\"region\", GetRegion(d, config))\n \n-\t//Set the current power_state:\n-\tif strings.ToLower(server.Status) != \"active\" && strings.ToLower(server.Status) != \"shutoff\" {\n-\t\treturn fmt.Errorf(\"Error changing the instance(%s) power_state. Invalid current power_state:%s \", d.Id(), server.Status)\n-\t} else {\n-\t\td.Set(\"power_state\", strings.ToLower(server.Status))\n+\t// Set the current power_state\n+\tvar validStatus bool\n+\tcurrentStatus := strings.ToLower(server.Status)\n+\tswitch currentStatus {\n+\tcase \"active\", \"shutoff\", \"error\":\n+\t\tvalidStatus = true\n \t}\n \n+\tif !validStatus {\n+\t\treturn fmt.Errorf(\"Invalid power_state for instance %s: %s\", d.Id(), server.Status)\n+\t}\n+\n+\td.Set(\"power_state\", currentStatus)","path":"openstack/resource_openstack_compute_instance_v2.go","position":48,"original_position":48,"commit_id":"08a6e4f8ab422db4fb3b6e8be07acf86de6bfa5d","original_commit_id":"08a6e4f8ab422db4fb3b6e8be07acf86de6bfa5d","user":{"login":"ChiefAlexander","id":13860012,"node_id":"MDQ6VXNlcjEzODYwMDEy","avatar_url":"https://avatars1.githubusercontent.com/u/13860012?v=4","gravatar_id":"","url":"https://api.github.com/users/ChiefAlexander","html_url":"https://github.com/ChiefAlexander","followers_url":"https://api.github.com/users/ChiefAlexander/followers","following_url":"https://api.github.com/users/ChiefAlexander/following{/other_user}","gists_url":"https://api.github.com/users/ChiefAlexander/gists{/gist_id}","starred_url":"https://api.github.com/users/ChiefAlexander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChiefAlexander/subscriptions","organizations_url":"https://api.github.com/users/ChiefAlexander/orgs","repos_url":"https://api.github.com/users/ChiefAlexander/repos","events_url":"https://api.github.com/users/ChiefAlexander/events{/privacy}","received_events_url":"https://api.github.com/users/ChiefAlexander/received_events","type":"User","site_admin":false},"body":"Move this into your switch statement instead of having a var validStatus so that we can join both the if statement for !validStatus and the switch","created_at":"2018-09-21T15:04:44Z","updated_at":"2018-09-21T15:05:09Z","html_url":"https://github.com/terraform-providers/terraform-provider-openstack/pull/428#discussion_r219529344","pull_request_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/comments/219529344"},"html":{"href":"https://github.com/terraform-providers/terraform-provider-openstack/pull/428#discussion_r219529344"},"pull_request":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428"}}},"pull_request":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428","id":217162244,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE3MTYyMjQ0","html_url":"https://github.com/terraform-providers/terraform-provider-openstack/pull/428","diff_url":"https://github.com/terraform-providers/terraform-provider-openstack/pull/428.diff","patch_url":"https://github.com/terraform-providers/terraform-provider-openstack/pull/428.patch","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/issues/428","number":428,"state":"open","locked":false,"title":"Compute v2: Allow power_state of error","user":{"login":"jtopjian","id":46959,"node_id":"MDQ6VXNlcjQ2OTU5","avatar_url":"https://avatars0.githubusercontent.com/u/46959?v=4","gravatar_id":"","url":"https://api.github.com/users/jtopjian","html_url":"https://github.com/jtopjian","followers_url":"https://api.github.com/users/jtopjian/followers","following_url":"https://api.github.com/users/jtopjian/following{/other_user}","gists_url":"https://api.github.com/users/jtopjian/gists{/gist_id}","starred_url":"https://api.github.com/users/jtopjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtopjian/subscriptions","organizations_url":"https://api.github.com/users/jtopjian/orgs","repos_url":"https://api.github.com/users/jtopjian/repos","events_url":"https://api.github.com/users/jtopjian/events{/privacy}","received_events_url":"https://api.github.com/users/jtopjian/received_events","type":"User","site_admin":false},"body":"This commit will allow an instance to cleanly transition into a\r\nstatus of \"error\". This will allow users to destroy instances\r\nwhich have changed into an error state either during creation\r\nor by some event outside of Terraform.\r\n\r\nFor #404 \r\n\r\nAdditional comments in #427 ","created_at":"2018-09-21T03:30:10Z","updated_at":"2018-09-21T15:05:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"39bb005a4c19fec3b6cdddc3b98344d4af9aedea","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ozerovandrei","id":14319296,"node_id":"MDQ6VXNlcjE0MzE5Mjk2","avatar_url":"https://avatars3.githubusercontent.com/u/14319296?v=4","gravatar_id":"","url":"https://api.github.com/users/ozerovandrei","html_url":"https://github.com/ozerovandrei","followers_url":"https://api.github.com/users/ozerovandrei/followers","following_url":"https://api.github.com/users/ozerovandrei/following{/other_user}","gists_url":"https://api.github.com/users/ozerovandrei/gists{/gist_id}","starred_url":"https://api.github.com/users/ozerovandrei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ozerovandrei/subscriptions","organizations_url":"https://api.github.com/users/ozerovandrei/orgs","repos_url":"https://api.github.com/users/ozerovandrei/repos","events_url":"https://api.github.com/users/ozerovandrei/events{/privacy}","received_events_url":"https://api.github.com/users/ozerovandrei/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":737912032,"node_id":"MDU6TGFiZWw3Mzc5MTIwMzI=","url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/labels/size/S","name":"size/S","color":"ffffff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428/commits","review_comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428/comments","review_comment_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/issues/428/comments","statuses_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/statuses/08a6e4f8ab422db4fb3b6e8be07acf86de6bfa5d","head":{"label":"jtopjian:allow-error-state","ref":"allow-error-state","sha":"08a6e4f8ab422db4fb3b6e8be07acf86de6bfa5d","user":{"login":"jtopjian","id":46959,"node_id":"MDQ6VXNlcjQ2OTU5","avatar_url":"https://avatars0.githubusercontent.com/u/46959?v=4","gravatar_id":"","url":"https://api.github.com/users/jtopjian","html_url":"https://github.com/jtopjian","followers_url":"https://api.github.com/users/jtopjian/followers","following_url":"https://api.github.com/users/jtopjian/following{/other_user}","gists_url":"https://api.github.com/users/jtopjian/gists{/gist_id}","starred_url":"https://api.github.com/users/jtopjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtopjian/subscriptions","organizations_url":"https://api.github.com/users/jtopjian/orgs","repos_url":"https://api.github.com/users/jtopjian/repos","events_url":"https://api.github.com/users/jtopjian/events{/privacy}","received_events_url":"https://api.github.com/users/jtopjian/received_events","type":"User","site_admin":false},"repo":{"id":94048572,"node_id":"MDEwOlJlcG9zaXRvcnk5NDA0ODU3Mg==","name":"terraform-provider-openstack","full_name":"jtopjian/terraform-provider-openstack","private":false,"owner":{"login":"jtopjian","id":46959,"node_id":"MDQ6VXNlcjQ2OTU5","avatar_url":"https://avatars0.githubusercontent.com/u/46959?v=4","gravatar_id":"","url":"https://api.github.com/users/jtopjian","html_url":"https://github.com/jtopjian","followers_url":"https://api.github.com/users/jtopjian/followers","following_url":"https://api.github.com/users/jtopjian/following{/other_user}","gists_url":"https://api.github.com/users/jtopjian/gists{/gist_id}","starred_url":"https://api.github.com/users/jtopjian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtopjian/subscriptions","organizations_url":"https://api.github.com/users/jtopjian/orgs","repos_url":"https://api.github.com/users/jtopjian/repos","events_url":"https://api.github.com/users/jtopjian/events{/privacy}","received_events_url":"https://api.github.com/users/jtopjian/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jtopjian/terraform-provider-openstack","description":"Terraform openstack provider","fork":true,"url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack","forks_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/forks","keys_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/teams","hooks_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/hooks","issue_events_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/issues/events{/number}","events_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/events","assignees_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/assignees{/user}","branches_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/branches{/branch}","tags_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/tags","blobs_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/statuses/{sha}","languages_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/languages","stargazers_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/stargazers","contributors_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/contributors","subscribers_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/subscribers","subscription_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/subscription","commits_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/contents/{+path}","compare_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/merges","archive_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/downloads","issues_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/issues{/number}","pulls_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/pulls{/number}","milestones_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/milestones{/number}","notifications_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/labels{/name}","releases_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/releases{/id}","deployments_url":"https://api.github.com/repos/jtopjian/terraform-provider-openstack/deployments","created_at":"2017-06-12T02:44:35Z","updated_at":"2017-08-02T08:05:35Z","pushed_at":"2018-09-21T03:29:24Z","git_url":"git://github.com/jtopjian/terraform-provider-openstack.git","ssh_url":"git@github.com:jtopjian/terraform-provider-openstack.git","clone_url":"https://github.com/jtopjian/terraform-provider-openstack.git","svn_url":"https://github.com/jtopjian/terraform-provider-openstack","homepage":"","size":6276,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"terraform-providers:master","ref":"master","sha":"da6bd01265bbcaeb5167b276fa360f6cde75390b","user":{"login":"terraform-providers","id":29154831,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5MTU0ODMx","avatar_url":"https://avatars0.githubusercontent.com/u/29154831?v=4","gravatar_id":"","url":"https://api.github.com/users/terraform-providers","html_url":"https://github.com/terraform-providers","followers_url":"https://api.github.com/users/terraform-providers/followers","following_url":"https://api.github.com/users/terraform-providers/following{/other_user}","gists_url":"https://api.github.com/users/terraform-providers/gists{/gist_id}","starred_url":"https://api.github.com/users/terraform-providers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terraform-providers/subscriptions","organizations_url":"https://api.github.com/users/terraform-providers/orgs","repos_url":"https://api.github.com/users/terraform-providers/repos","events_url":"https://api.github.com/users/terraform-providers/events{/privacy}","received_events_url":"https://api.github.com/users/terraform-providers/received_events","type":"Organization","site_admin":false},"repo":{"id":93446101,"node_id":"MDEwOlJlcG9zaXRvcnk5MzQ0NjEwMQ==","name":"terraform-provider-openstack","full_name":"terraform-providers/terraform-provider-openstack","private":false,"owner":{"login":"terraform-providers","id":29154831,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5MTU0ODMx","avatar_url":"https://avatars0.githubusercontent.com/u/29154831?v=4","gravatar_id":"","url":"https://api.github.com/users/terraform-providers","html_url":"https://github.com/terraform-providers","followers_url":"https://api.github.com/users/terraform-providers/followers","following_url":"https://api.github.com/users/terraform-providers/following{/other_user}","gists_url":"https://api.github.com/users/terraform-providers/gists{/gist_id}","starred_url":"https://api.github.com/users/terraform-providers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terraform-providers/subscriptions","organizations_url":"https://api.github.com/users/terraform-providers/orgs","repos_url":"https://api.github.com/users/terraform-providers/repos","events_url":"https://api.github.com/users/terraform-providers/events{/privacy}","received_events_url":"https://api.github.com/users/terraform-providers/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/terraform-providers/terraform-provider-openstack","description":"Terraform OpenStack provider","fork":false,"url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack","forks_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/forks","keys_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/teams","hooks_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/hooks","issue_events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/issues/events{/number}","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/events","assignees_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/assignees{/user}","branches_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/branches{/branch}","tags_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/tags","blobs_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/git/refs{/sha}","trees_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/statuses/{sha}","languages_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/languages","stargazers_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/stargazers","contributors_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/contributors","subscribers_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/subscribers","subscription_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/subscription","commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/commits{/sha}","git_commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/git/commits{/sha}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/comments{/number}","issue_comment_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/issues/comments{/number}","contents_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/contents/{+path}","compare_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/merges","archive_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/downloads","issues_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/issues{/number}","pulls_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls{/number}","milestones_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/milestones{/number}","notifications_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/labels{/name}","releases_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/releases{/id}","deployments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/deployments","created_at":"2017-06-05T20:54:08Z","updated_at":"2018-09-21T04:45:42Z","pushed_at":"2018-09-21T04:45:40Z","git_url":"git://github.com/terraform-providers/terraform-provider-openstack.git","ssh_url":"git@github.com:terraform-providers/terraform-provider-openstack.git","clone_url":"https://github.com/terraform-providers/terraform-provider-openstack.git","svn_url":"https://github.com/terraform-providers/terraform-provider-openstack","homepage":"https://www.terraform.io/docs/providers/openstack/","size":6207,"stargazers_count":77,"watchers_count":77,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":115,"mirror_url":null,"archived":false,"open_issues_count":69,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":115,"open_issues":69,"watchers":77,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428"},"html":{"href":"https://github.com/terraform-providers/terraform-provider-openstack/pull/428"},"issue":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/issues/428"},"comments":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/issues/428/comments"},"review_comments":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428/comments"},"review_comment":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/pulls/428/commits"},"statuses":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-openstack/statuses/08a6e4f8ab422db4fb3b6e8be07acf86de6bfa5d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ChiefAlexander"}}