-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: support destroy_execution_order_group #5979
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
base: main
Are you sure you want to change the base?
feat: support destroy_execution_order_group #5979
Conversation
Add DestroyExecutionOrderGroup field to Project configuration structs to support reverse execution order during destroy operations. - Add field to raw.Project with YAML parsing - Propagate through valid.Project and MergedProjectCfg - Update configuration merge and validation pipeline Signed-off-by: Rômulo Silva <[email protected]>
Implement core logic to detect -destroy flag and respect destroy_execution_order_group during destroy operations. - Add IsDestroy, EffectiveExecutionOrderGroup fields to ProjectContext - Detect -destroy flag in comment parser - Implement assignEffectiveExecutionGroups function - Update splitByExecutionOrderGroup to use effective groups - Modify runProjectCmdsParallelGroups to handle destroy mode Signed-off-by: Rômulo Silva <[email protected]>
Prevent PRs from being blocked by obsolete policy check status from previous plan executions. - Add resetPolicyStatus function to clear pending policies - Apply reset in both runAutoplan and run methods - Reload PullStatus after reset to update context - Preserve existing plan/apply status during reset Signed-off-by: Rômulo Silva <[email protected]>
Add comprehensive unit tests to validate destroy_execution_order_group functionality and policy status reset behavior. - Update 10 existing tests with EffectiveExecutionOrderGroup field - Add 4 unit tests for assignEffectiveExecutionGroups scenarios - Add parametrized tests for destroy order (Partial, AllDefined, NoneDefined) - Add 2 tests for policy status reset (manual and autoplan) - Validate correct execution order for plan and apply commands Signed-off-by: Rômulo Silva <[email protected]>
Fix commit SHA extraction when git outputs warnings alongside the commit hash (e.g., 'warning: refname HEAD is ambiguous'). - Use regex to extract valid SHA from git output - Ignore warning lines in rev-parse output - Add fallback to old behavior if parsing fails - Update test to validate sanitized output Signed-off-by: Rômulo Silva <[email protected]>
Add comprehensive documentation for destroy operations with execution order groups in atlantis.yaml configuration. - Add 'Order of destroying' section with usage examples - Document destroy_execution_order_group field specification - Provide workflow examples for Terraform, OpenTofu, and Terragrunt - Explain fallback rules and execution behavior - Improve -destroy flag usage documentation Signed-off-by: Rômulo Silva <[email protected]>
|
Very welcome contribution @romuloslv! looking forward to use it!! |
|
This contribution is very important for various resources. RDS is very complex to destroy. It will certainly help many people. Congratulations @romuloslv , may it be approved soon and go into production. |
|
There has been some discussion of order groups vs depends on, and how we might want to try to collapse those two concepts into one, I'm not sure if/how that's relevant here, thoughts @jamengual ? |
|
yes, anything related to execution groups or sequence of executions needs to wait until we figure out the best approach. |
|
I agree regarding the integration between the two concepts Currently, for Terragrunt-based workflows, we can configure the following keys in atlantis.yaml:
In an ideal scenario, I would like to define the key(s) in atlantis.yaml and successfully execute, within a PR, the following commands: @jamengual you mentioned that not all maintainers are able to use Terragrunt for testing, and that PRs are welcome. I can contribute, including running tests, if there is any guidance on how we should handle dependency scenarios within Atlantis. |
what
This pull request enables
destroy_execution_order_groupwhy
To support reverse execution order during destroy operations
atlantis plan/apply -- -destroy. Currently, Atlantis supportsexecution_order_groupfor both resource creation and destruction. However, when hierarchical dependencies orchestrated by Terragrunt are present, resource destruction must be performed in reverse order, ensuring that child resources are removed before their parent resources. The implementation adds automatic detection of the-destroyflag, calculates effective execution groups based on operation type, and maintains backward compatibility with existing configurations. Both destructive and non-destructive global plan/apply operations work correctly in the same PR - regular operations useexecution_order_groupwhile destroy operations usedestroy_execution_order_group, allowing users to safely test both creation and destruction workflows before merging.tests
Tests added in
references