Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform destroy fails when GCP disk used by multiple instances #3410

Closed
ghost opened this issue Apr 10, 2019 · 4 comments
Closed

Terraform destroy fails when GCP disk used by multiple instances #3410

ghost opened this issue Apr 10, 2019 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 10, 2019

This issue was originally opened by @honnibal as hashicorp/terraform#20963. It was migrated here as a result of the provider split. The original body of the issue is below.


Re Issue hashicorp/terraform#8667, PR hashicorp/terraform#14651

I have a readonly google_compute_disk that's attached to multiple instances. When I do terraform destroy, I get an Error detaching disk error, noting that an instance was not found. If I run delete a second time, it succeeds.

I'm using v0.11.8.

Further details:

  • The disk is defined in the top-level main.tf
  • The disk is used by an instance template within a managed instance group, within a submodule.
  • In order to pass the disk into the submodule, I pass it by name (since I can't get a reference to the resource in the submodule)
@emilymye
Copy link
Contributor

Providing config and debug logs would be helpful. My best guess is that since you are passing the disk by name instead of interpolating a value from the resource, Terraform cannot know it needs to delete the disks after it deletes the users of the disk. Usually, interpolation would have added an implicit depends_on.

Generally this is done by providing it via an input variable for the module. Is disk not an input variable for the module?

@honnibal
Copy link

honnibal commented Apr 16, 2019

I think you're right that this was a general misconfiguration on my part, thanks. I'll close this as I doubt it's a bug.

@ghost ghost removed the waiting-response label Apr 16, 2019
@danawillow
Copy link
Contributor

Closing as per comment.

@ghost
Copy link
Author

ghost commented Jun 14, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants