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

Delete managed OS disk when destroying VM #127

Closed
cehoffman opened this issue Jun 24, 2017 · 9 comments
Closed

Delete managed OS disk when destroying VM #127

cehoffman opened this issue Jun 24, 2017 · 9 comments

Comments

@cehoffman
Copy link

cehoffman commented Jun 24, 2017

Given an azurerm_virtual_machine using a managed OS disk is created then destroyed. The same configuration can not be reused because the managed OS disk resource still exists. When a VM is destroyed and has a managed OS disk, the OS disk should be destroyed too to prevent leaking of resources.

Data disks have the problem too, but it can be mitigated using the azurerm_managed_disk resource separately and linking to that created instance in the storage_data_disk block. The OS block can not do this due to azurerm_managed_disk not supporting creation FromImage.

@DWSR
Copy link

DWSR commented Jun 26, 2017

I can confirm this behaviour +1

@StephenWeatherford
Copy link
Contributor

StephenWeatherford commented Jun 26, 2017

@cehoffman
Copy link
Author

Huh, I'll have to give that a try. Thought I had read over all the flags, but apparently that one didn't stick in my head. Will report back once I get to try it.

@StephenWeatherford
Copy link
Contributor

Is there a way we can improve the documentation so that you would have found this more easily? Thx.

@cehoffman
Copy link
Author

Only suggestion I have is to include it in one of the examples. Overall the examples are so good you don't usually need to look much at the detailed options to get going.

@cehoffman
Copy link
Author

This works as advertised.

@cehoffman cehoffman reopened this Jun 27, 2017
@StephenWeatherford
Copy link
Contributor

To summarize - the behavior noted is by design. If users want to have the OS or data disks deleted with the VM, they can use the delete_{os,data}_disk{,s}_on_termination flags.

Looking into whether the docs can make this easier to find.

@tombuildsstuff
Copy link
Contributor

Associated PR: #139

@ghost
Copy link

ghost commented Apr 1, 2020

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 👉 hashibot-feedback@hashicorp.com. Thanks!

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

Successfully merging a pull request may close this issue.

4 participants