Remove the broken auto_delete_disk system, and replace it with a working snapshot-based alternative, in the NFS Server module#3887
Merged
tpdownes merged 4 commits intoApr 24, 2025
Conversation
Contributor
|
/gcbrun |
tpdownes
suggested changes
Apr 23, 2025
tpdownes
left a comment
Contributor
There was a problem hiding this comment.
@ndebuhr due to a bug in the provider, this would be a breaking change for all Terraform Google provider plugins below 6.14.0. Please modify versions.tf accordingly.
My preference would be moved block that puts the boot disk management entirely within the google_compute_instance resource but Terraform does not support re-factoring of a resource into an attribute within another resource.
…ute instance recreation during auto_delete boot disk changes (versions <6.14)
tpdownes
approved these changes
Apr 23, 2025
tpdownes
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Thank you for the submission and response to change requests!
Contributor
|
/gcbrun |
SwarnaBharathiMantena
approved these changes
Apr 24, 2025
Contributor
|
/gcbrun |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
auto_deleteparameter (and thereforeauto_delete_diskvariable) within the NFS instance'sboot_diskblock is only effective when the instance implicitly creates the boot disk (i.e., disk properties are defined directly within the instance block usinginitialize_params). Even withauto_delete=false, the separategoogle_compute_diskresource goes through it's own destroy lifecycle and the disk is deleted - so ultimately, the variable currently does nothing.This PR addresses reproducible issue #3566, which was introduced as a regression in bb47067
This PR addresses the
auto_deleteissue, and more broadly expands the data retention options by:create_snapshot_before_destroyandcreate_boot_snapshot_before_destroyDesign notes:
null_resource, custom lifecycle management, and dedicated bootcompute_diskspecification), which blocks the ability to use the boot diskauto_deletecontrol.auto_delete_diskvariable is nevertheless deprecated, rather than simply removed, to inform users of the snapshot-before-destroy alternative (encouraging proactive config changes to avoid accidental data deletion events). Terraform updates to add snapshot-before-destroy are quick and in-place.auto_delete=falsedoes not impact deletion behavior due to thegoogle_compute_disk's separate destroy lifecycle, it is important to enable the snapshot-before-destroy feature. If the disk is deleted in connection with the VM instance (i.e.,auto_delete=true), then the snapshot does not trigger. If the disk is deleted during it's own dedicated destroy lifecycle (i.e.,auto_delete=false), then the snapshot does trigger. So theauto_deletehas no impact on module deletion behavior, but it needs to be hard-coded asauto_delete=falsefor snapshot enablement.Manually tested a variety of scenarios with Terraform v1.11.3 and Packer v1.12.0