{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/3171","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/3171/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/3171/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/3171/events","html_url":"https://github.com/hashicorp/terraform/issues/3171","id":104793313,"number":3171,"title":"Recover partial state when instance times out in cloudstack provider","user":{"login":"glenjamin","id":151272,"avatar_url":"https://avatars.githubusercontent.com/u/151272?v=3","gravatar_id":"","url":"https://api.github.com/users/glenjamin","html_url":"https://github.com/glenjamin","followers_url":"https://api.github.com/users/glenjamin/followers","following_url":"https://api.github.com/users/glenjamin/following{/other_user}","gists_url":"https://api.github.com/users/glenjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/glenjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glenjamin/subscriptions","organizations_url":"https://api.github.com/users/glenjamin/orgs","repos_url":"https://api.github.com/users/glenjamin/repos","events_url":"https://api.github.com/users/glenjamin/events{/privacy}","received_events_url":"https://api.github.com/users/glenjamin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/provider/cloudstack","name":"provider/cloudstack","color":"bfdadc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-03T22:26:17Z","updated_at":"2015-09-28T11:03:19Z","closed_at":"2015-09-28T11:03:19Z","body":"The aws provider stores the resource ID quite early on in the process:\r\nhttps://github.com/hashicorp/terraform/blob/master/builtin/providers/aws/resource_aws_instance.go#L377\r\n\r\nWhereas the cloudstack provider waits until go-cloudstack has returned before storing anything\r\nhttps://github.com/hashicorp/terraform/blob/master/builtin/providers/cloudstack/resource_cloudstack_instance.go#L194\r\n\r\nThe actual cloudstack API for this is async, but this is hidden from us by the go-cloudstack driver\r\nhttps://github.com/xanzy/go-cloudstack/blob/master/cloudstack/VirtualMachineService.go#L411\r\n\r\n\r\nIt would be quite handy if the provider was able to store some VM information even when initial deploy step \"fails\" - such as when VM creation exceeds the timeout.\r\n\r\nI can think of two options for this:\r\n1. update the go-cloudstack lib so that it can expose the async job part of the deploy, and then use that api in the provider\r\n2. in the event of a deploy failure, try calling `GetVirtualMachineByName` and denoting how far it got in the state file\r\n\r\n\r\nIf I understand terraform correctly (I'm pretty new to it), then this would also allow the provider to kick-off provisioning steps after recovering from the failure?"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/143713399","html_url":"https://github.com/hashicorp/terraform/issues/3171#issuecomment-143713399","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/3171","id":143713399,"user":{"login":"glenjamin","id":151272,"avatar_url":"https://avatars.githubusercontent.com/u/151272?v=3","gravatar_id":"","url":"https://api.github.com/users/glenjamin","html_url":"https://github.com/glenjamin","followers_url":"https://api.github.com/users/glenjamin/followers","following_url":"https://api.github.com/users/glenjamin/following{/other_user}","gists_url":"https://api.github.com/users/glenjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/glenjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glenjamin/subscriptions","organizations_url":"https://api.github.com/users/glenjamin/orgs","repos_url":"https://api.github.com/users/glenjamin/repos","events_url":"https://api.github.com/users/glenjamin/events{/privacy}","received_events_url":"https://api.github.com/users/glenjamin/received_events","type":"User","site_admin":false},"created_at":"2015-09-28T11:03:19Z","updated_at":"2015-09-28T11:03:19Z","body":"I've got a clearer picture of how cloudstack's APIs work now, and you are of course correct.\r\n\r\nOur cloud provider can take between 2 and 30 minutes to provision VMs, we'll crank the timeout up even higher - but it's pretty annoying.\r\n\r\nI think the feature that actually solves my problem would be https://github.com/hashicorp/terraform/issues/2976"}}