feat(destroy): default to robust destroy for all gcluster destroy operations - #6190
feat(destroy): default to robust destroy for all gcluster destroy operations#6190Neelabh94 wants to merge 1 commit into
gcluster destroy operations#6190Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modifies the default behavior of the destroy command by enabling the robust destruction process automatically. This change ensures that firewall rule cleanup is performed by default, while still allowing users to opt-out by explicitly passing the flag. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request changes the default value of the --robust flag in the destroy command from false to true and updates the documentation accordingly. However, feedback highlights that setting this to true by default introduces a critical regression: if the firewall cleanup fails, the command aborts early and skips the actual terraform destroy for subsequent groups. The reviewer recommends keeping the default as false or refactoring the cleanup to be non-fatal.
| addAutoApproveFlag( | ||
| addArtifactsDirFlag(destroyCmd)))) | ||
| destroyCmd.Flags().BoolVar(&robustDestroy, "robust", false, "Perform a robust destroy, including firewall rule cleanup.") | ||
| destroyCmd.Flags().BoolVar(&robustDestroy, "robust", true, "Perform a robust destroy, including firewall rule cleanup.") |
There was a problem hiding this comment.
Changing the default of --robust to true introduces a critical regression in the destroy command.
The Issue
When robustDestroy is true (which is now the default), destroyGroup attempts to clean up firewall rules if a network module is present. If this cleanup fails (e.g., due to missing ADC or permissions), it immediately aborts the loop, skipping the actual terraform destroy for this and subsequent groups.
Recommendation
In accordance with our state cleanup guidelines, we should use a best-effort approach for cleanup operations. Instead of failing fast and aborting the entire destroy sequence, the firewall cleanup failures should be logged as errors/warnings and the process should continue. This ensures maximum cleanup of remaining infrastructure and avoids blocking subsequent teardown retries. Alternatively, keep the default as false until the cleanup error handling is refactored to be non-fatal.
| destroyCmd.Flags().BoolVar(&robustDestroy, "robust", true, "Perform a robust destroy, including firewall rule cleanup.") | |
| destroyCmd.Flags().BoolVar(&robustDestroy, "robust", false, "Perform a robust destroy, including firewall rule cleanup.") |
References
- When performing state cleanup (such as removing unreachable resources from Terraform state), use a best-effort approach by logging errors and continuing rather than failing fast or returning a combined error. This ensures maximum cleanup of remaining infrastructure and avoids blocking subsequent teardown retries.
gcluster destroy operations
gcluster destroy operationsgcluster destroy operations
This PR makes robust as the default for destroy.
Submission Checklist
NOTE: Community submissions can take up to 2 weeks to be reviewed.
Please take the following actions before submitting this pull request.