Open jrhellriegeljr opened 3 months ago
Hi @jrhellriegeljr!
Today there are many ways to handle this. You can implement for example an auto_delete for the boot_disk
then when you need to apply changes you can create a new one and attach it to the google_compute_instance
. You can read the Google Cloud documentation to understand how the different available options works. Or maybe you are looking for something like a google_compute_image
In terraform registry and Google Cloud Documentation you can find many features that could fit your needs.
Community Note
Terraform Version & Provider Version(s)
Terraform v1.8.5 on linux_amd64
Affected Resource(s)
google_compute_disk google_compute_instance
Terraform Configuration
Debug Output
No response
Expected Behavior
One of:
Actual Behavior
A google_compute_instance with a boot disk linked to a google_compute_disk resource that becomes destroyed and recreated as part of a terraform apply results in the instance no longer having any boot disk association (yet terraform still thinks there is a disk attached).
Steps to reproduce
terraform apply
terraform apply
Important Factoids
No response
References
In fairness it seems that the provider has other code paths that require a delete/create of the google_compute_instance so this alternate path may be less desirable - still - something is not right:
The still-attached-disk probably shouldn't be deleted (or add a flag to force detachement) The GCE instance shouldn't be left without a boot disk (unless maybe the added flag was used) Ideally the GCE instance would reflect the new disk without having to be destroy/created again (which was my ultimate goal when I set out to write this code).