Skip to content

feat: add support for the --all flag to destroy#2271

Open
benklop wants to merge 2 commits intocloudposse:mainfrom
benklop:add-all-to-destroy
Open

feat: add support for the --all flag to destroy#2271
benklop wants to merge 2 commits intocloudposse:mainfrom
benklop:add-all-to-destroy

Conversation

@benklop
Copy link
Copy Markdown

@benklop benklop commented Apr 1, 2026

what

add flag support (like --all) to the destroy command, to allow destroy to tear down a stack using dependency ordering (once that's working properly).

why

Especially while testing new features that use lots of various terraform components, it's useful to be able to deploy, test, then destroy entire stacks at once.

references

Summary by CodeRabbit

Release Notes

  • New Features

    • Multi-component destroy support with dependency-aware ordering (dependents destroyed before dependencies)
    • Added --affected flag to destroy affected components
    • Added --all flag to destroy all components in a stack
  • Documentation

    • Updated terraform destroy command documentation with multi-component operation details and flag descriptions

@benklop benklop requested a review from a team as a code owner April 1, 2026 03:30
@github-actions github-actions bot added the size/m Medium size PR label Apr 1, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

This pull request extends the terraform destroy command with multi-component support, integrating it into Atmos's shared flag and options framework. Changes include adding --affected and --all flags, wiring the command through the ParseTerraformRunOptions flow, and updating documentation with usage examples and multi-component behavior details.

Changes

Cohort / File(s) Summary
Command Integration
cmd/terraform/destroy.go
Added destroyParser variable and integrated viper with flag bindings. Updated RunE to use ParseTerraformRunOptions and terraformRunWithOptions instead of direct terraformRun. Configured parser with backend flags plus new boolean flags --affected and --all.
Test Coverage
cmd/terraform/destroy_test.go
New test verifying destroyParser is non-nil and asserting that destroyCmd registers expected flags: --all, --affected, and --auto-generate-backend-file.
Documentation
website/docs/cli/commands/terraform/terraform-destroy.mdx
Added usage examples for --all flag, documented --affected flag behavior, included multi-component execution details with dependency-aware ordering, and introduced "Multi-Component Operations" section explaining flag support and --include-dependents behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

minor

Suggested reviewers

  • aknysh
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add support for the --all flag to destroy' directly and clearly describes the main change: adding the --all flag to the destroy command.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
website/docs/cli/commands/terraform/terraform-destroy.mdx (1)

97-102: ⚠️ Potential issue | 🟡 Minor

Clarify that component is not required for multi-component modes.

The argument is marked as "(required)" but --all, --affected, --components, and --query modes don't require a positional component argument. This could confuse users.

Suggested fix
 <dl>
-    <dt>`component` <em>(required)</em></dt>
+    <dt>`component`</dt>
     <dd>
-        Atmos component name.
+        Atmos component name. Required for single-component destroys; omit when using `--all`, `--affected`, `--components`, or `--query`.
     </dd>
 </dl>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@website/docs/cli/commands/terraform/terraform-destroy.mdx` around lines 97 -
102, The docs currently mark the `component` positional argument as "(required)"
even though multi-component modes (`--all`, `--affected`, `--components`,
`--query`) do not need it; update the description near the `component` term to
clarify that `component` is required only for single-component mode and is
optional/ignored when using `--all`, `--affected`, `--components`, or `--query`,
and include a short note describing the behavior of those flags relative to
`component`.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@website/docs/cli/commands/terraform/terraform-destroy.mdx`:
- Around line 97-102: The docs currently mark the `component` positional
argument as "(required)" even though multi-component modes (`--all`,
`--affected`, `--components`, `--query`) do not need it; update the description
near the `component` term to clarify that `component` is required only for
single-component mode and is optional/ignored when using `--all`, `--affected`,
`--components`, or `--query`, and include a short note describing the behavior
of those flags relative to `component`.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fe5db488-c912-4a83-b64c-c487940418ca

📥 Commits

Reviewing files that changed from the base of the PR and between 2c0a3dd and d660189.

📒 Files selected for processing (3)
  • cmd/terraform/destroy.go
  • cmd/terraform/destroy_test.go
  • website/docs/cli/commands/terraform/terraform-destroy.mdx

@benklop benklop changed the title OGS-470 adds support for the --all flag to destroy, documents it, and… feat: add support for the --all flag to destroy Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant