Skip to content

docs: add comprehensive Terraform planfile documentation and command reference#1498

Merged
aknysh merged 133 commits intomainfrom
custom-planfile
Nov 24, 2025
Merged

docs: add comprehensive Terraform planfile documentation and command reference#1498
aknysh merged 133 commits intomainfrom
custom-planfile

Conversation

@osterman
Copy link
Member

@osterman osterman commented Sep 23, 2025

What

This PR adds comprehensive documentation for Terraform planfiles and complete reference documentation for all Terraform commands in Atmos.

Planfile Documentation

  • New comprehensive guide: website/docs/core-concepts/terraform/planfiles.mdx
  • Covers what planfiles are, how they work, benefits, and best practices
  • Documents Terraform backend limitations and security considerations
  • Includes workflow examples and integration patterns

Terraform Command Documentation

Complete reference documentation for all Terraform commands:

  • terraform apply, terraform plan, terraform destroy
  • terraform init, terraform get, terraform validate
  • terraform state, terraform import, terraform taint/untaint
  • terraform output, terraform show, terraform version
  • terraform providers, terraform modules, terraform workspace
  • And many more...

Each command page includes:

  • Purpose and use cases
  • Atmos-specific behavior and enhancements
  • Usage examples
  • Arguments and flags
  • Screengrabs showing actual CLI output

Color Output Improvements

  • Fixed NO_COLOR environment variable detection
  • Proper terminal capability detection and degradation
  • Fixed ANSI code leakage in validation messages
  • Improved UI output with proper line clearing

Why

  • Users needed comprehensive documentation for Terraform planfile workflows
  • Command reference was incomplete or missing for many Terraform commands
  • Documentation had inconsistencies and broken links
  • Color output wasn't properly respecting NO_COLOR specification

Testing

  • ✅ All documentation builds successfully
  • ✅ All links verified
  • ✅ Screengrabs generated for all commands
  • ✅ Golden snapshots regenerated and passing
  • ✅ NO_COLOR tests passing

References

  • Addresses documentation gaps in Terraform command coverage
  • Improves planfile workflow documentation

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Summary by CodeRabbit

  • New Features

    • Comprehensive user docs added for Terraform commands (apply, plan, destroy, init, etc.) and many auth subcommands (console, env, exec, list, login, logout, shell, user, validate, whoami).
    • New CLI flags: --force-color, --force-tty, --mask, --redirect-stderr; ATMOS_FORCE_COLOR env support.
  • Improvements

    • Theme-aware, color-capable help output with improved code-block styling and examples.
    • Robust pager detection with graceful fallbacks.
  • Documentation

    • Expanded planfile and workflow guidance and numerous help pages for CLI commands.

✏️ Tip: You can customize this high-level summary in your review settings.

Add complete documentation for Terraform planfile functionality in Atmos, including:

- New command reference pages for `terraform plan` and `terraform apply`
- Comprehensive planfile guide in core concepts section
- Cross-references in existing documentation

## What

- Created `/cli/commands/terraform/terraform-plan.mdx` documenting the plan command with all planfile-related flags
- Created `/cli/commands/terraform/terraform-apply.mdx` documenting the apply command with planfile usage
- Created `/core-concepts/terraform/planfiles.mdx` comprehensive guide covering:
  - How Atmos manages planfiles (naming convention, storage)
  - Different ways to specify custom planfiles
  - CI/CD integration examples (GitHub Actions, GitLab CI)
  - Terraform Cloud compatibility
  - Best practices and troubleshooting
- Updated existing documentation with cross-references

## Why

The planfile functionality was scattered across multiple documentation files and wasn't easily discoverable. Users needed a centralized, comprehensive guide to understand:
- How Atmos handles planfiles differently from native Terraform
- The automatic planfile naming convention (`<context>-<component>.planfile`)
- Various ways to work with planfiles (--from-plan, --planfile, -out flags)
- Integration patterns for CI/CD pipelines

This documentation makes the planfile functionality more discoverable and provides clear guidance for common use cases.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@osterman osterman requested a review from a team as a code owner September 23, 2025 16:32
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2025

📝 Walkthrough

Walkthrough

Large refactor that redesigns Atmos CLI help rendering (theme-aware markdown, flag layout, pager and color handling), adds extensive Terraform command docs and screengrab assets, extends command/provider interfaces, and updates tests and snapshots to match the new help output and color/pager behavior.

Changes

Cohort / File(s) Summary
Help rendering & CLI root
cmd/root.go, cmd/help_template.go, cmd/help_template_test.go, cmd/help_template_test.go, cmd/help_template.go
Add template-driven, theme-aware help renderer, markdown/flag rendering, early color/profile setup, pager integration, profiler wiring, and many new helper functions/tests.
Markdown renderer & styles
pkg/ui/markdown/*.go, pkg/ui/markdown/*_test.go, pkg/ui/markdown/help_styles.go
New help-specific Markdown renderer, codeblock styling, help styles JSON, and comprehensive tests for styling/tokenization.
UI/theme & formatter
pkg/ui/formatter.go, pkg/ui/theme/colors.go, pkg/ui/theme/styles.go, pkg/ui/theme/*_test.go
Centralize color profile handling, expose SetColorProfile/ClearLine/InvalidateStyleCache, refactor legacy Styles to runtime-built StylesStruct and add tests.
Terminal env & logger
pkg/terminal/env/color.go, pkg/terminal/env/color_test.go, pkg/logger/global.go, pkg/terminal/terminal.go
Add IsColorEnabled utility, early NO_COLOR-aware logger setup, and related tests and docs.
Pager & pager tests
pkg/pager/pager.go, pkg/pager/pager_test.go, cmd/root_pager_config_test.go
Add /dev/tty accessibility checks, graceful fallback on pager failure, and tests for pager flag precedence/behavior.
Global flags & config
pkg/flags/global_registry.go, pkg/flags/standard.go, pkg/config/load.go, pkg/schema/schema.go
Register terminal/global flags (force-color, force-tty, mask, redirect-stderr), bind inherited flags to viper, add Terminal.ForceColor (env-only).
Command/provider API changes
cmd/internal/command.go, implementations in cmd/* (list, theme, profile, etc.), cmd/internal/registry_test.go
Extend CommandProvider interface with GetFlagsBuilder, GetPositionalArgsBuilder, GetCompatibilityFlags and add no-op implementations across providers/tests.
Terraform docs & CLI commands
website/docs/cli/commands/terraform/terraform-*.mdx, cmd/terraform.go, cmd/terraform_generate.go, cmd/terraform/generate/varfile/*
Add ~22 new Terraform MDX docs, planfiles core-concept doc, embed terraform differences markdown, move varfile generation to new subcommand pattern.
Screengrab assets & build infra
website/src/components/Screengrabs/*.html, demo/screengrabs/build-all.sh, demo/screengrabs/Makefile, demo/screengrabs/Brewfile
Add/replace 50+ help HTML screengrabs (many show generation stubs), improve build scripts (dependency checks, portable sed, docker targets), and Brewfile.
Tests & snapshots
tests/snapshots/*, tests/test-cases/*, cmd/*_test.go, pkg/ui/markdown/*_test.go
Update 40+ golden snapshots and many tests to reflect new uppercase headers, telemetry notice, color/profile behavior, and sanitization mappings; add numerous unit tests for rendering/pager/markdown.
Utilities & small refactors
internal/tui/utils/utils.go, internal/exec/*, pkg/utils/version_utils.go, internal/exec/spinner_utils.go, cmd/* markdown tweaks
Add AnsiRegularFont constant, switch UI calls to generic ui, strip ANSI in tests, adjust spinner to use dynamic styles, and minor markdown/code-fence formatting changes.
Docs & developer guides
CLAUDE.md, docs/prd/help-system-architecture.md, website/blog/*.mdx
Add/revise developer guidance and a PRD describing the new help system and theme-aware help blog posts.
Go modules
go.mod
Add direct dependencies: charmbracelet/colorprofile and charmbracelet/x/term.
Misc
.gitignore, cmd/cmd_utils.go, main.go
Add *.ansi ignore, change flag usage exit behavior to return error with exit code, handle --version in main via ExecuteVersion().

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CobraCmd as Cobra Command
    participant ApplyTemplate as applyColoredHelpTemplate
    participant Renderer as Markdown Renderer
    participant Pager as Pager
    participant TerminalEnv as Env Detector

    User->>CobraCmd: runs "atmos --help" or "atmos <cmd> --help"
    CobraCmd->>ApplyTemplate: invoke help function
    ApplyTemplate->>TerminalEnv: detect color / ATMOS_FORCE_COLOR
    TerminalEnv-->>ApplyTemplate: color decision
    ApplyTemplate->>Renderer: build help content (markdown + flag layout)
    Renderer-->>ApplyTemplate: rendered output
    ApplyTemplate->>Pager: decide pager (config/flag/TTY)
    Pager-->>ApplyTemplate: pager available?
    alt pager usable
        ApplyTemplate->>Pager: run pager with rendered output
        Pager-->>User: paged output
    else fallback
        ApplyTemplate->>User: print rendered output directly
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Files needing focused review:
    • cmd/root.go & cmd/help_template.go — flag rendering, ANSI stripping, markdown integration, telemetry hooks.
    • pkg/ui/markdown/codeblock.go & help_styles.go — tokenization/styling correctness and terminal-width handling.
    • pkg/ui/theme/colors.go & styles.go, pkg/ui/formatter.go — runtime style rebuilds, profile application, and thread-safety implications.
    • pkg/pager/pager.go — /dev/tty checks and fallback correctness.
    • cmd/internal/command.go and all CommandProvider implementations — ensure interface additions implemented everywhere.

Possibly related PRs

Suggested reviewers

  • aknysh

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.98% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately summarizes the primary change: comprehensive Terraform planfile documentation and command reference addition, aligning with the substantial documentation content across 27+ new files.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch custom-planfile

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5a6b9a3 and 6d34d0b.

📒 Files selected for processing (1)
  • tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden

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.

@github-actions github-actions bot added the size/xl Extra large size PR label Sep 23, 2025
@mergify
Copy link

mergify bot commented Sep 23, 2025

Warning

This PR exceeds the recommended limit of 1,000 lines.

Large PRs are difficult to review and may be rejected due to their size.

Please verify that this PR does not address multiple issues.
Consider refactoring it into smaller, more focused PRs to facilitate a smoother review process.

@osterman osterman added the no-release Do not create a new release (wait for additional code changes) label Sep 23, 2025
osterman and others added 2 commits September 23, 2025 11:38
Create comprehensive documentation for all supported Terraform commands in Atmos.

## What

Added documentation for 22 Terraform commands:
- terraform init - Initialize working directory
- terraform validate - Validate configuration syntax
- terraform destroy - Destroy infrastructure
- terraform output - Extract output values
- terraform show - Display state or plan
- terraform refresh - Update state to match remote
- terraform import - Import existing resources
- terraform state - Advanced state management
- terraform fmt - Format configuration files
- terraform console - Interactive expression evaluation
- terraform version - Display version information
- terraform providers - Show provider requirements
- terraform graph - Generate dependency graph
- terraform get - Download modules
- terraform force-unlock - Release stuck state lock
- terraform taint - Mark resource for recreation
- terraform untaint - Remove tainted state
- terraform test - Run module tests
- terraform login - Authenticate with Terraform Cloud
- terraform logout - Remove stored credentials
- terraform metadata - Access metadata functions
- terraform modules - List referenced modules

## Why

Previously, many Terraform commands supported by Atmos lacked dedicated documentation pages. Users had to rely on the generic usage.mdx file or Terraform's native documentation to understand how these commands work with Atmos.

This comprehensive documentation:
- Provides consistent reference pages for all commands
- Shows Atmos-specific usage patterns and flags
- Includes practical examples for each command
- Documents how Atmos enhances native Terraform functionality
- Makes the full command set more discoverable

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed all internal links to use the correct URL paths based on document IDs rather than filenames.
For example, /cli/commands/terraform/terraform-plan is now /cli/commands/terraform/plan.

This resolves the Docusaurus build errors about broken links.
Added screen grab generation for all Terraform commands:
- terraform apply --help
- terraform console --help
- terraform destroy --help
- terraform fmt --help
- terraform force-unlock --help
- terraform get --help
- terraform graph --help
- terraform import --help
- terraform init --help
- terraform login --help
- terraform logout --help
- terraform metadata --help
- terraform modules --help
- terraform output --help
- terraform plan --help
- terraform plan-diff --help
- terraform providers --help
- terraform refresh --help
- terraform show --help
- terraform state --help
- terraform taint --help
- terraform test --help
- terraform untaint --help
- terraform validate --help
- terraform version --help

Also added missing list and validate commands:
- list components/metadata/settings/stacks/values/vars/workflows --help
- validate editorconfig --help
- validate schema --help

These will be used to generate screen grabs for the documentation.
…tation

- Added info boxes to all Terraform command documentation explaining what Atmos does special
- Distinguished between pure passthrough commands (fmt, version, login, logout) and enhanced commands
- Documented Atmos enhancements like automatic init, workspace management, variable file generation
- Clarified component locking behavior for state-modifying commands (state, taint, untaint)
- Highlighted special features like AWS_REGION setting for import command
- Added context about when Atmos runs terraform init automatically

This makes it clear to users when Atmos provides value-add vs when it's just passing through to native Terraform.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link

codecov bot commented Sep 23, 2025

Codecov Report

❌ Patch coverage is 78.19820% with 242 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.97%. Comparing base (72f6449) to head (6d34d0b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/help_template.go 75.73% 66 Missing and 16 partials ⚠️
cmd/root.go 68.33% 64 Missing and 18 partials ⚠️
pkg/ui/markdown/codeblock.go 89.38% 6 Missing and 6 partials ⚠️
pkg/ui/formatter.go 66.66% 8 Missing and 2 partials ⚠️
pkg/ui/markdown/renderer.go 74.35% 5 Missing and 5 partials ⚠️
internal/tui/utils/utils.go 70.96% 5 Missing and 4 partials ⚠️
pkg/pager/pager.go 64.00% 8 Missing and 1 partial ⚠️
cmd/list/list.go 0.00% 6 Missing ⚠️
cmd/profile/profile.go 0.00% 6 Missing ⚠️
cmd/theme/theme.go 0.00% 6 Missing ⚠️
... and 4 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1498      +/-   ##
==========================================
+ Coverage   71.65%   71.97%   +0.32%     
==========================================
  Files         466      471       +5     
  Lines       44224    45222     +998     
==========================================
+ Hits        31690    32550     +860     
- Misses       9974    10076     +102     
- Partials     2560     2596      +36     
Flag Coverage Δ
unittests 71.97% <78.19%> (+0.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/helmfile_sync.go 100.00% <ø> (ø)
cmd/terraform.go 100.00% <ø> (ø)
cmd/terraform/generate/varfile/varfile.go 100.00% <100.00%> (ø)
cmd/terraform_generate.go 100.00% <100.00%> (ø)
internal/exec/spinner_utils.go 73.17% <100.00%> (+0.67%) ⬆️
internal/exec/validate_stacks.go 83.33% <100.00%> (+0.10%) ⬆️
pkg/config/load.go 78.27% <100.00%> (+0.04%) ⬆️
pkg/flags/global_registry.go 97.16% <100.00%> (+0.48%) ⬆️
pkg/schema/schema.go 88.00% <ø> (ø)
pkg/terminal/env/color.go 100.00% <100.00%> (ø)
... and 19 more

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…ns and benefits

- Add comprehensive explanation of why planfiles are important
- Document which backends support/don't support planfiles (Terraform/OpenTofu core limitation)
- Clarify that Remote, Terraform Cloud, and HTTP backends have limitations
- Add specific error messages users will encounter
- Include GitLab-specific integration guidance
- Add real-world examples for multi-environment and compliance workflows
- Enhance benefits section with performance metrics and use cases
- Add backend feature comparison table
- Include troubleshooting for credential embedding issues
Copy link
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.

Actionable comments posted: 16

Caution

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

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

126-130: Fix command name in example and stray space before period.

The example under --planfile uses apply instead of deploy and has an extra space before the period.

-        The path to a planfile. The `--planfile` flag should be used instead of the planfile argument in the native `terraform apply <planfile>` command .
+        The path to a planfile. The `--planfile` flag should be used instead of the planfile argument in the native `terraform apply <planfile>` command.
@@
-        atmos terraform apply <component> -s <stack> --planfile <planfile>
+        atmos terraform deploy <component> -s <stack> --planfile <planfile>
website/docs/cli/commands/terraform/terraform-init.mdx (1)

351-355: Fix Related Commands links (use page IDs, not filenames)

Links should target the IDs you set (plan, apply, clean, workspace).

-- [`atmos terraform plan`](/cli/commands/terraform/terraform-plan) - Generate execution plan
-- [`atmos terraform apply`](/cli/commands/terraform/terraform-apply) - Apply changes
-- [`atmos terraform clean`](/cli/commands/terraform/terraform-clean) - Clean terraform files
-- [`atmos terraform workspace`](/cli/commands/terraform/terraform-workspace) - Manage workspaces
+- [`atmos terraform plan`](/cli/commands/terraform/plan) - Generate execution plan
+- [`atmos terraform apply`](/cli/commands/terraform/apply) - Apply changes
+- [`atmos terraform clean`](/cli/commands/terraform/clean) - Clean terraform files
+- [`atmos terraform workspace`](/cli/commands/terraform/workspace) - Manage workspaces
🧹 Nitpick comments (37)
demo/screengrabs/demo-stacks.txt (1)

34-41: Good addition of list-group helps.

Reads well and matches the CLI groupings.

Consider alphabetizing the subcommands (components, metadata, settings, stacks, values, vars, workflows) for easier scanning.

website/docs/cli/commands/terraform/terraform-version.mdx (3)

7-9: Remove unused import.

Terminal is imported but not used. Drop it to avoid dead imports.

 import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'

25-26: Clarify provider version output.

terraform version doesn’t always list provider versions; this depends on context and flags (e.g., -json in a module dir with lockfile). Tighten the claim.

-This command displays the Terraform or OpenTofu version, along with the versions of installed providers.
+This command displays the Terraform or OpenTofu version. When run in a component directory, using `-json` may also include detailed plugin/provider information.

27-29: State toolchain selection behavior (Terraform vs OpenTofu).

If Atmos still resolves the toolchain based on component/stack metadata, note it here for clarity.

Proposed addition after the first sentence:

Atmos still resolves the toolchain (Terraform vs OpenTofu) based on the component/stack configuration before executing the command.

Please confirm this is accurate per current CLI behavior.

website/docs/cli/commands/terraform/terraform-force-unlock.mdx (2)

7-8: Remove unused import.

Terminal is not used.

 import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'

18-18: Minor copy tweak for consistency.

Prefer “Atmos command” over “terraform … command” here.

-Execute the `terraform force-unlock` command like this:
+Execute the Atmos command like this:
website/docs/cli/commands/terraform/terraform-refresh.mdx (5)

8-8: Remove unused import.

Terminal is imported but not used in this file.

-import Terminal from '@site/src/components/Terminal'

10-13: Add a deprecation/caveat note about upstream Terraform refresh.

Terraform has deprecated/removed terraform refresh in favor of plan/apply with -refresh-only in newer versions. Add a brief caution so users know what Atmos wraps and any version caveats.

 :::note purpose
 Use this command to update the Terraform state to match remote systems.
 :::
+
+:::caution
+Terraform has deprecated the standalone `terraform refresh` command in newer versions in favor of `terraform plan -refresh-only` / `terraform apply -refresh-only`. Atmos supports a refresh workflow and will use the appropriate underlying Terraform invocation for your installed version. Check your Terraform version and prefer `-refresh-only` semantics when applicable.
+:::

18-22: Minor copy tweak for clarity.

Clarify this is the Atmos wrapper around Terraform’s refresh.

-Execute the `terraform refresh` command like this:
+Execute the Atmos wrapper for Terraform refresh:

93-96: Reword to avoid overcommitting and link upstream docs.

Avoid promising specific native flags across versions; point to Terraform docs and keep an example list.

-This command supports native `terraform refresh` flags such as `-target=RESOURCE` to refresh specific resources, `-var` to override variables, `-var-file` to specify variable files.
+This command passes through supported native flags for your Terraform version (for example, `-var`, `-var-file`). For targeted refresh, use `-target=RESOURCE` only if your Terraform version supports it. See the Terraform CLI documentation for the full, version‑specific list.

43-49: Confirmed: terraform refresh accepts -target but is deprecated — prefer -refresh-only.

Terraform 1.x still provides terraform refresh and it accepts planning/apply flags (including -target); HashiCorp recommends using terraform plan/apply -refresh-only instead.
Location: website/docs/cli/commands/terraform/terraform-refresh.mdx (lines 43–49)
Action: example is valid as-is, or optionally update to atmos terraform plan -s dev -refresh-only -target=aws_instance.web or add a deprecation note.

website/docs/cli/commands/terraform/terraform-untaint.mdx (2)

8-8: Drop unused import or use Terminal in examples.

Terminal is imported but not used. Either remove it or wrap the command examples with <Terminal> for consistency with other pages.

Apply this diff to remove the unused import:

-import Terminal from '@site/src/components/Terminal'

24-24: Clarify deprecation and recommend using -replace (add version)

Replace the line with:

"This command removes the tainted state from a resource, preventing it from being destroyed and recreated on the next apply.

Note: Upstream terraform untaint is deprecated. Prefer using -replace=ADDR with terraform plan/apply (added in Terraform v0.15.2, May 5, 2021). This command is provided for backward compatibility."

website/docs/cli/commands/terraform/usage.mdx (3)

113-113: End sentence with a period and keep link style consistent.

Add a trailing period for polish.

-  is saved to the component's folder. See [Terraform Planfiles](/core-concepts/terraform/planfiles) for comprehensive planfile documentation
+  is saved to the component's folder. See [Terraform Planfiles](/core-concepts/terraform/planfiles) for comprehensive planfile documentation.

119-119: Add trailing period to match style.

-  planfile. Learn more in the [terraform apply](/cli/commands/terraform/apply) documentation
+  planfile. Learn more in the [terraform apply](/cli/commands/terraform/apply) documentation.

124-124: Add trailing period to match style.

-  Terraform Cloud automatically stores plans in its backend and can't store it in a local file. See [terraform plan](/cli/commands/terraform/plan) for details
+  Terraform Cloud automatically stores plans in its backend and can't store it in a local file. See [terraform plan](/cli/commands/terraform/plan) for details.
website/docs/cli/commands/terraform/terraform-test.mdx (1)

10-12: Capitalize the “Purpose” title for consistency.

Other pages use “:::note Purpose”.

-:::note purpose
+:::note Purpose
website/docs/cli/commands/terraform/terraform-show.mdx (2)

10-12: Capitalize the “Purpose” title for consistency.

-:::note purpose
+:::note Purpose

41-43: Consider adding ‘--’ before the planfile for consistency.

Elsewhere we document using -- to pass native args. Add a second example showing:
atmos terraform show vpc -s dev -- planfile.tfplan.

website/docs/cli/commands/terraform/terraform-validate.mdx (2)

10-12: Capitalize the “Purpose” title for consistency.

-:::note purpose
+:::note Purpose

109-144: Reorder sections to match house style (Usage → Examples → Arguments → Flags).

Move “Arguments” and “Flags” above the “When to Use Validate” and other guidance sections.

website/docs/cli/commands/terraform/terraform-taint.mdx (1)

10-12: Capitalize the “Purpose” title for consistency.

-:::note purpose
+:::note Purpose
website/docs/cli/commands/terraform/terraform-modules.mdx (1)

10-12: Capitalize the “Purpose” title for consistency.

-:::note purpose
+:::note Purpose
website/docs/cli/commands/terraform/terraform-providers.mdx (2)

10-12: Capitalize the “Purpose” title for consistency.

-:::note purpose
+:::note Purpose

88-91: Separate flags from subcommands; fix wording.

Clarify that schema, lock, and mirror are subcommands, not flags, and keep flags (e.g., -platform) distinct.

-This command supports native `terraform providers` flags such as Subcommands include `schema` for detailed schema info, `lock` for dependency locking, `mirror` for provider mirroring.
+This command supports native `terraform providers` subcommands such as `schema` (detailed schema info), `lock` (dependency locking), and `mirror` (provider mirroring). Flags (e.g., `-platform`) are supported where applicable.
website/docs/cli/commands/terraform/terraform-state.mdx (2)

10-12: Capitalize the “Purpose” title for consistency.

-:::note purpose
+:::note Purpose

95-98: Separate flags from subcommands; fix wording.

Clarify that list, show, mv, rm, pull, push, replace-provider are subcommands, and mention commonly used flags like -state distinctly.

-This command supports native `terraform state` flags such as Subcommands include `list`, `show`, `mv`, `rm`, `pull`, `push`, `replace-provider`. Use `-state` to specify state file path..
+This command supports native `terraform state` subcommands: `list`, `show`, `mv`, `rm`, `pull`, `push`, `replace-provider`. Common flags include `-state` to specify a state file path.
website/docs/core-concepts/terraform/planfiles.mdx (1)

69-74: Soften the unqualified performance claim.

The “50–70% faster” figure is context‑dependent. Prefer qualitative guidance.

-### 4. **Operational Efficiency**
-- **Faster Apply**: No need to refresh state or recalculate the dependency graph (can be 50-70% faster)
+### 4. **Operational Efficiency**
+- **Faster Apply**: Often faster since Terraform can skip state refresh and dependency graph recalculation
website/docs/cli/commands/terraform/terraform-metadata.mdx (2)

74-77: Fix “Native Terraform Flags” sentence

Grammatical error and unclear statement. If this page is retained for a real command, clarify subcommands and examples.

-This command supports native `terraform metadata` flags such as Subcommands include `functions` for function metadata..
+If available, this command would support specific subcommands (for example, `functions`) to inspect metadata. Provide concrete examples and valid flags/subcommands here.

7-9: Remove unused import

Terminal isn’t used on this page.

-import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'
+import Screengrab from '@site/src/components/Screengrab'
website/docs/cli/commands/terraform/terraform-destroy.mdx (1)

7-9: Remove unused import

Terminal isn’t used.

-import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'
+import Screengrab from '@site/src/components/Screengrab'
website/docs/cli/commands/terraform/terraform-plan.mdx (1)

7-9: Remove unused import

Terminal isn’t used.

-import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'
+import Screengrab from '@site/src/components/Screengrab'
website/docs/cli/commands/terraform/terraform-get.mdx (1)

7-9: Remove unused import

Terminal isn’t used.

-import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'
+import Screengrab from '@site/src/components/Screengrab'
website/docs/cli/commands/terraform/terraform-logout.mdx (2)

83-84: Fix “Native Terraform Flags” wording

This command takes an optional hostname argument; it’s not a flag.

-This command supports native `terraform logout` flags such as Takes an optional hostname argument to specify which credentials to remove..
+This command accepts an optional hostname argument to specify which credentials to remove (e.g., `terraform.company.com`).

7-9: Remove unused import

Terminal isn’t used.

-import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'
+import Screengrab from '@site/src/components/Screengrab'
website/docs/cli/commands/terraform/terraform-apply.mdx (1)

7-9: Remove unused import

Terminal isn’t used.

-import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'
+import Screengrab from '@site/src/components/Screengrab'
website/docs/cli/commands/terraform/terraform-init.mdx (1)

7-9: Remove unused import

Terminal isn’t used.

-import Screengrab from '@site/src/components/Screengrab'
-import Terminal from '@site/src/components/Terminal'
+import Screengrab from '@site/src/components/Screengrab'
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6274d75 and b5f934d.

📒 Files selected for processing (28)
  • demo/screengrabs/demo-stacks.txt (1 hunks)
  • website/docs/cli/commands/terraform/terraform-apply.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-console.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-deploy.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-destroy.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-fmt.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-force-unlock.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-get.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-graph.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-import.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-init.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-login.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-logout.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-metadata.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-modules.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-output.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-plan.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-providers.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-refresh.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-show.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-state.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-taint.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-test.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-untaint.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-validate.mdx (1 hunks)
  • website/docs/cli/commands/terraform/terraform-version.mdx (1 hunks)
  • website/docs/cli/commands/terraform/usage.mdx (1 hunks)
  • website/docs/core-concepts/terraform/planfiles.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
website/**

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

website/**: Update website documentation in website/ when adding features
Ensure consistency between CLI help text and website documentation
Follow the website's documentation structure and style
Keep website code in website/ and follow its architecture/style; test changes locally
Keep CLI and website documentation in sync; document new features with examples and use cases

Files:

  • website/docs/cli/commands/terraform/terraform-deploy.mdx
  • website/docs/cli/commands/terraform/terraform-force-unlock.mdx
  • website/docs/cli/commands/terraform/terraform-taint.mdx
  • website/docs/cli/commands/terraform/terraform-init.mdx
  • website/docs/cli/commands/terraform/terraform-login.mdx
  • website/docs/cli/commands/terraform/usage.mdx
  • website/docs/cli/commands/terraform/terraform-test.mdx
  • website/docs/cli/commands/terraform/terraform-console.mdx
  • website/docs/cli/commands/terraform/terraform-version.mdx
  • website/docs/cli/commands/terraform/terraform-logout.mdx
  • website/docs/cli/commands/terraform/terraform-destroy.mdx
  • website/docs/core-concepts/terraform/planfiles.mdx
  • website/docs/cli/commands/terraform/terraform-validate.mdx
  • website/docs/cli/commands/terraform/terraform-fmt.mdx
  • website/docs/cli/commands/terraform/terraform-output.mdx
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • website/docs/cli/commands/terraform/terraform-get.mdx
  • website/docs/cli/commands/terraform/terraform-providers.mdx
  • website/docs/cli/commands/terraform/terraform-untaint.mdx
  • website/docs/cli/commands/terraform/terraform-modules.mdx
  • website/docs/cli/commands/terraform/terraform-refresh.mdx
  • website/docs/cli/commands/terraform/terraform-plan.mdx
  • website/docs/cli/commands/terraform/terraform-graph.mdx
  • website/docs/cli/commands/terraform/terraform-state.mdx
  • website/docs/cli/commands/terraform/terraform-show.mdx
  • website/docs/cli/commands/terraform/terraform-import.mdx
  • website/docs/cli/commands/terraform/terraform-metadata.mdx
website/docs/cli/commands/**/*.mdx

📄 CodeRabbit inference engine (CLAUDE.md)

website/docs/cli/commands/**/*.mdx: All new commands/flags/parameters MUST have Docusaurus documentation using definition lists

instead of tables for arguments and flags
Follow Docusaurus conventions from existing files including consistent section ordering (Usage → Examples → Arguments → Flags), use purpose notes and screengrabs

Files:

  • website/docs/cli/commands/terraform/terraform-deploy.mdx
  • website/docs/cli/commands/terraform/terraform-force-unlock.mdx
  • website/docs/cli/commands/terraform/terraform-taint.mdx
  • website/docs/cli/commands/terraform/terraform-init.mdx
  • website/docs/cli/commands/terraform/terraform-login.mdx
  • website/docs/cli/commands/terraform/usage.mdx
  • website/docs/cli/commands/terraform/terraform-test.mdx
  • website/docs/cli/commands/terraform/terraform-console.mdx
  • website/docs/cli/commands/terraform/terraform-version.mdx
  • website/docs/cli/commands/terraform/terraform-logout.mdx
  • website/docs/cli/commands/terraform/terraform-destroy.mdx
  • website/docs/cli/commands/terraform/terraform-validate.mdx
  • website/docs/cli/commands/terraform/terraform-fmt.mdx
  • website/docs/cli/commands/terraform/terraform-output.mdx
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • website/docs/cli/commands/terraform/terraform-get.mdx
  • website/docs/cli/commands/terraform/terraform-providers.mdx
  • website/docs/cli/commands/terraform/terraform-untaint.mdx
  • website/docs/cli/commands/terraform/terraform-modules.mdx
  • website/docs/cli/commands/terraform/terraform-refresh.mdx
  • website/docs/cli/commands/terraform/terraform-plan.mdx
  • website/docs/cli/commands/terraform/terraform-graph.mdx
  • website/docs/cli/commands/terraform/terraform-state.mdx
  • website/docs/cli/commands/terraform/terraform-show.mdx
  • website/docs/cli/commands/terraform/terraform-import.mdx
  • website/docs/cli/commands/terraform/terraform-metadata.mdx
🧠 Learnings (17)
📓 Common learnings
Learnt from: Listener430
PR: cloudposse/atmos#934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to website/** : Keep CLI and website documentation in sync; document new features with examples and use cases
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to website/** : Update website documentation in website/ when adding features
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to website/** : Ensure consistency between CLI help text and website documentation
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.

Applied to files:

  • demo/screengrabs/demo-stacks.txt
  • website/docs/cli/commands/terraform/terraform-test.mdx
  • website/docs/cli/commands/terraform/terraform-version.mdx
  • website/docs/cli/commands/terraform/terraform-fmt.mdx
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • website/docs/cli/commands/terraform/terraform-modules.mdx
  • website/docs/cli/commands/terraform/terraform-refresh.mdx
  • website/docs/cli/commands/terraform/terraform-show.mdx
  • website/docs/cli/commands/terraform/terraform-metadata.mdx
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
PR: cloudposse/atmos#825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.

Applied to files:

  • demo/screengrabs/demo-stacks.txt
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.

Applied to files:

  • demo/screengrabs/demo-stacks.txt
  • website/docs/cli/commands/terraform/terraform-validate.mdx
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
PR: cloudposse/atmos#1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.

Applied to files:

  • demo/screengrabs/demo-stacks.txt
  • website/docs/cli/commands/terraform/terraform-force-unlock.mdx
  • website/docs/cli/commands/terraform/terraform-taint.mdx
  • website/docs/cli/commands/terraform/terraform-init.mdx
  • website/docs/cli/commands/terraform/terraform-login.mdx
  • website/docs/cli/commands/terraform/terraform-test.mdx
  • website/docs/cli/commands/terraform/terraform-console.mdx
  • website/docs/cli/commands/terraform/terraform-version.mdx
  • website/docs/cli/commands/terraform/terraform-logout.mdx
  • website/docs/cli/commands/terraform/terraform-destroy.mdx
  • website/docs/cli/commands/terraform/terraform-validate.mdx
  • website/docs/cli/commands/terraform/terraform-fmt.mdx
  • website/docs/cli/commands/terraform/terraform-output.mdx
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • website/docs/cli/commands/terraform/terraform-get.mdx
  • website/docs/cli/commands/terraform/terraform-providers.mdx
  • website/docs/cli/commands/terraform/terraform-untaint.mdx
  • website/docs/cli/commands/terraform/terraform-modules.mdx
  • website/docs/cli/commands/terraform/terraform-refresh.mdx
  • website/docs/cli/commands/terraform/terraform-plan.mdx
  • website/docs/cli/commands/terraform/terraform-state.mdx
  • website/docs/cli/commands/terraform/terraform-show.mdx
  • website/docs/cli/commands/terraform/terraform-import.mdx
  • website/docs/cli/commands/terraform/terraform-metadata.mdx
📚 Learning: 2024-10-21T17:51:53.976Z
Learnt from: osterman
PR: cloudposse/atmos#727
File: internal/exec/terraform.go:114-118
Timestamp: 2024-10-21T17:51:53.976Z
Learning: When `atmos terraform clean --everything` is used without specifying a component and without the `--force` flag, prompt the user for confirmation before deleting all components. Use the `--force` flag to skip the confirmation prompt.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-force-unlock.mdx
  • website/docs/cli/commands/terraform/terraform-init.mdx
  • website/docs/cli/commands/terraform/usage.mdx
  • website/docs/cli/commands/terraform/terraform-destroy.mdx
  • website/docs/cli/commands/terraform/terraform-validate.mdx
  • website/docs/cli/commands/terraform/terraform-fmt.mdx
  • website/docs/cli/commands/terraform/terraform-apply.mdx
  • website/docs/cli/commands/terraform/terraform-untaint.mdx
  • website/docs/cli/commands/terraform/terraform-refresh.mdx
  • website/docs/cli/commands/terraform/terraform-plan.mdx
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-taint.mdx
  • website/docs/cli/commands/terraform/terraform-test.mdx
📚 Learning: 2024-12-03T04:01:16.446Z
Learnt from: aknysh
PR: cloudposse/atmos#810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:0-0
Timestamp: 2024-12-03T04:01:16.446Z
Learning: In the `terraform.output.mdx` documentation file (`website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx`), the cache invalidation and cache scope behavior for the `!terraform.output` function are already described.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-taint.mdx
  • website/docs/cli/commands/terraform/terraform-output.mdx
  • website/docs/cli/commands/terraform/terraform-metadata.mdx
📚 Learning: 2024-12-01T00:33:20.298Z
Learnt from: aknysh
PR: cloudposse/atmos#810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-test.mdx
  • website/docs/cli/commands/terraform/terraform-output.mdx
📚 Learning: 2025-09-23T03:44:59.111Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-23T03:44:59.111Z
Learning: Applies to website/docs/cli/commands/**/*.mdx : Follow Docusaurus conventions from existing files including consistent section ordering (Usage → Examples → Arguments → Flags), use purpose notes and screengrabs

Applied to files:

  • website/docs/cli/commands/terraform/terraform-console.mdx
📚 Learning: 2024-10-27T16:59:26.187Z
Learnt from: osterman
PR: cloudposse/atmos#729
File: internal/exec/help.go:48-51
Timestamp: 2024-10-27T16:59:26.187Z
Learning: In the Atmos CLI help messages, when providing examples that include the version number, use the actual version variable (e.g., `version.Version`) instead of placeholders like `<version>`.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-version.mdx
📚 Learning: 2024-10-31T19:23:45.538Z
Learnt from: osterman
PR: cloudposse/atmos#727
File: internal/exec/terraform.go:65-66
Timestamp: 2024-10-31T19:23:45.538Z
Learning: The variable `shouldCheckStack` in `ExecuteTerraform` controls whether validation is performed.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-validate.mdx
📚 Learning: 2024-12-03T03:49:30.395Z
Learnt from: aknysh
PR: cloudposse/atmos#810
File: website/docs/core-concepts/stacks/yaml-functions/terraform.output.mdx:104-110
Timestamp: 2024-12-03T03:49:30.395Z
Learning: In the documentation for `!terraform.output`, warnings about template variable availability are already covered in other sections, so no need to suggest adding them here.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-output.mdx
📚 Learning: 2024-12-03T05:29:07.718Z
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:145-146
Timestamp: 2024-12-03T05:29:07.718Z
Learning: In the Atmos project, a 5-minute timeout in the `execTerraformOutput` function is acceptable for retrieving `terraform output` for a component in a stack.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-output.mdx
📚 Learning: 2024-12-03T05:18:49.169Z
Learnt from: aknysh
PR: cloudposse/atmos#810
File: internal/exec/terraform_utils.go:40-213
Timestamp: 2024-12-03T05:18:49.169Z
Learning: In the context of the Atmos project, it's acceptable for functions like `execTerraformOutput` to remain as single functions if they perform a single purpose, such as retrieving Terraform outputs for a component in a stack, even if the function is lengthy.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-output.mdx
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
PR: cloudposse/atmos#1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-apply.mdx
📚 Learning: 2025-09-10T21:17:55.273Z
Learnt from: samtholiya
PR: cloudposse/atmos#1466
File: toolchain/http_client_test.go:3-10
Timestamp: 2025-09-10T21:17:55.273Z
Learning: In the cloudposse/atmos repository, imports should never be changed as per samtholiya's coding guidelines.

Applied to files:

  • website/docs/cli/commands/terraform/terraform-import.mdx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: website-deploy-preview
  • GitHub Check: Summary
🔇 Additional comments (40)
demo/screengrabs/demo-stacks.txt (7)

47-47: LGTM.

Help-only invocation avoids interactive console.


49-51: LGTM.

Nice coverage of fmt/force-unlock alongside destroy.


58-66: Looks consistent; minor note on interactive commands.

login/logout are help-only, which is good for non-interactive screengrabs.

Confirm these help commands don’t attempt any network calls in CI (some CLIs initialize SDKs even on --help).


67-70: Double-check plan-diff doc parity.

plan-diff is included here; ensure a corresponding page (terraform-plan-diff.mdx) exists and is linked from the Terraform index.

You can reuse the earlier script; it checks for terraform-plan-diff.


72-78: Solid coverage of the remaining Terraform ops.

This aligns with the new reference pages.


82-83: Validate help behavior matches prior guidance.

Per past learnings, validate commands handle help differently; confirm these run without stack config and only display relevant params in examples.

If needed, add a quick CI check that runs:

  • atmos validate editorconfig --help
  • atmos validate schema --help
    and asserts exit code 0.

45-45: Ensure matching docs exist for each Terraform command — verification inconclusive

Verification script failed with "/bin/bash: line 13: !: command not found", so I couldn't confirm presence of the docs. Confirm these paths exist and cross‑refs are present:

  • website/docs/cli/commands/terraform/terraform-{apply,console,destroy,fmt,force-unlock,get,graph,import,init,login,logout,metadata,modules,output,plan,plan-diff,providers,refresh,show,state,taint,test,untaint,validate,version}.md*
  • website/docs/core-concepts/terraform/planfiles.md*
  • Add links to the Planfiles concept from usage and terraform-deploy docs under website/docs/**/ if missing.
website/docs/cli/commands/terraform/terraform-version.mdx (4)

88-90: Validate related links resolve — OK

Files website/docs/cli/commands/terraform/terraform-plan.mdx, terraform-apply.mdx, terraform-init.mdx define ids "plan", "apply", "init" respectively, so /cli/commands/terraform/plan, /apply, /init will resolve.


15-15: Ignore — screengrab references are auto-generated

Per repository convention, screengrab entries (e.g. website/docs/cli/commands/terraform/terraform-version.mdx:15) are generated programmatically and excluded from manual review; no asset-existence check needed.

Likely an incorrect or invalid review comment.


72-79: Keep --dry-run — it's supported for terraform subcommands.
Registered as a persistent flag in cmd/terraform_commands.go and handled in internal/exec/cli_utils.go and internal/exec/terraform.go; tests and other terraform docs reference it.


21-23: Confirm whether component/stack are actually required.

Docs show <component> and -s <stack> as required for version. Since this is a passthrough and doesn’t do init/workspace/vars, these might be optional. Align with CLI help.

Run to compare against help/snapshots:

If optional, update usage and argument/flag sections accordingly.

website/docs/cli/commands/terraform/terraform-force-unlock.mdx (2)

1-6: Add explicit slug to keep URL consistent with related command links.

Without an explicit slug, this page may render at /cli/commands/terraform/terraform-force-unlock instead of /cli/commands/terraform/force-unlock.

Apply:

 ---
 title: atmos terraform force-unlock
 sidebar_label: force-unlock
 sidebar_class_name: command
-id: force-unlock
+id: force-unlock
+slug: /cli/commands/terraform/force-unlock
 ---

64-89: Confirmed — docs are correct: --skip-init and --dry-run are supported

Both flags are registered as persistent flags on the terraform parent command (cmd/terraform_commands.go:273, 281) and consumed by the terraform execution code (internal/exec/terraform.go / internal/exec/terraform_utils.go), so the documentation for atmos terraform force-unlock is accurate.

website/docs/cli/commands/terraform/terraform-refresh.mdx (4)

26-33: Nice Atmos-specific enhancements section.

Clear and consistent with other Terraform command docs.


68-91: Flags section structure LGTM.

Uses

, required/optional labels, and inline examples. Matches house style.


14-14: Add or confirm screengrab asset for slug atmos-terraform-refresh--help.
rg shows only the usage at website/docs/cli/commands/terraform/terraform-refresh.mdx:14 — search the screengrab registry/assets for that slug and add the matching entry if missing.


99-101: Related-command links verified — target pages exist and frontmatter ids match: website/docs/cli/commands/terraform/terraform-plan.mdx (id: plan), terraform-apply.mdx (id: apply), terraform-init.mdx (id: init).

website/docs/cli/commands/terraform/terraform-untaint.mdx (5)

56-79: Flags section looks good.


16-16: Overall structure aligns with conventions.

Usage → Examples → Arguments → Flags ordering and use of

look consistent.


87-89: Command links resolve — plan, apply, init frontmatter ids found.
No action required.


26-28: Resolved — untaint is blocked when metadata.locked: true

internal/exec/terraform.go includes "untaint" in the locked-command switch (around line 119) which returns ErrLockedComponent; internal/exec/terraform_utils.go also lists "untaint" among native Terraform commands.


81-84: Add explicit example for native Terraform flags pass‑through.

Atmos accepts native Terraform flags directly (terraformCmd.DisableFlagParsing = true) and also supports explicit pass‑through after -- (see cmd/terraform.go and cmd/cmd_utils.go).

Apply this diff:

-This command supports native `terraform untaint` flags such as `-lock=false` to disable state locking, `-lock-timeout` to override lock timeout.
+This command supports native `terraform untaint` flags such as `-lock=false` (disable state locking) and `-lock-timeout` (override lock timeout).
+
+```shell
+# Passing native flags
+atmos terraform untaint vpc -s dev -lock=false aws_instance.web
+# (If your shell requires, you can also use pass-through:)
+# atmos terraform untaint vpc -s dev -- -lock=false aws_instance.web
+```
website/docs/cli/commands/terraform/terraform-modules.mdx (1)

16-25: Keep as‑is — terraform modules is a valid Terraform CLI command (requires Terraform ≥ 1.10.0).

Official Terraform CLI includes terraform modules (supports -json); no replacement needed. Optionally add a brief note about the minimum Terraform version if compatibility with older releases matters.

Likely an incorrect or invalid review comment.

website/docs/cli/commands/terraform/terraform-test.mdx (1)

88-91: Confirmed — native terraform flags are accurate

terraform test supports -filter, -verbose, and -json (verified against HashiCorp Terraform docs).

website/docs/cli/commands/terraform/usage.mdx (1)

119-119: Confirmed: target doc IDs exist.

Both links resolve — files found: website/docs/cli/commands/terraform/terraform-apply.mdx (id: apply) and website/docs/cli/commands/terraform/terraform-plan.mdx (id: plan).

website/docs/cli/commands/terraform/terraform-taint.mdx (1)

24-28: Confirmed: terraform taint is deprecated — use terraform apply -replace

HashiCorp marks terraform taint as deprecated and recommends using terraform apply -replace (or terraform plan -replace); -replace has been available since Terraform v0.15.2.

website/docs/cli/commands/terraform/terraform-console.mdx (1)

16-29: Looks solid and consistent with CLI docs structure.

Good use of Screengrab, section ordering (Usage → Examples → Arguments → Flags), and definition lists. Native flags listed correctly for console.

website/docs/cli/commands/terraform/terraform-deploy.mdx (1)

172-175: Nice cross‑link to Planfiles.

Good addition to steer users to the comprehensive guide.

website/docs/cli/commands/terraform/terraform-fmt.mdx (1)

17-29: LGTM — passthrough behavior is clear.

Structure, examples, and definition lists are consistent with conventions.

website/docs/cli/commands/terraform/terraform-graph.mdx (1)

16-29: LGTM — accurate and consistent.

Good callouts on DOT output and Graphviz usage. Sections follow the required order.

website/docs/cli/commands/terraform/terraform-output.mdx (1)

16-29: LGTM — thorough and aligned with conventions.

Examples cover key modes (all, named, -json, -raw). Uses definition lists correctly.

website/docs/core-concepts/terraform/planfiles.mdx (4)

499-508: Generate planfile command and flags present — confirmed.

Docs and tests show atmos terraform generate planfile supports --format and --file: website/docs/cli/commands/terraform/terraform-generate-planfile.mdx, website/docs/core-concepts/terraform/planfiles.mdx, internal/exec/terraform_generate_planfile_test.go.


463-464: ATMOS_COMPONENTS_TERRAFORM_PLAN_SKIP_PLANFILE is supported

Found in pkg/config/utils.go (os.Getenv + strconv.ParseBool) and documented in website/docs/cli/configuration/configuration.mdx and website/docs/cli/commands/terraform/terraform-plan.mdx — no change required.


472-490: Confirmed: atmos terraform plan-diff exists and supports --orig / --new

Evidence:

  • cmd/terraform_commands.go — defines Use: "plan-diff" and registers orig/new flags (orig marked required).
  • Implementation: internal/exec/terraform_plan_diff.go
  • Docs: website/docs/cli/commands/terraform/terraform-plan-diff.mdx reflect same usage.

142-147: Verify and correct quoted Terraform error text (typo in code block).

Code block in website/docs/core-concepts/terraform/planfiles.mdx (lines 142–147) contains "only to way". Confirm the exact upstream Terraform error message for the remote backend and update the doc to quote it verbatim — the message should state that run-scoped CLI variables aren’t supported and direct users to use a '*.auto.tfvars' file or workspace/environment variables.

website/docs/cli/commands/terraform/terraform-destroy.mdx (1)

16-33: Solid structure and content

Usage, enhancements, and caveats read well and align with other command pages.

website/docs/cli/commands/terraform/terraform-apply.mdx (1)

1-336: Looks good — -replace is supported by terraform apply (only when apply generates the plan)
When apply creates the plan (no saved planfile) it accepts -replace; if using --from-plan/--planfile, add -replace when you ran terraform plan instead.

website/docs/cli/commands/terraform/terraform-plan.mdx (1)

91-99: Docs match implementation — planfile naming & storage verified

Naming is implemented in internal/exec/path_utils.go (constructTerraformComponentPlanfileName: <context>-<component>.planfile or <context>-<folder_prefix>-<component>.planfile — folder prefix '/''-' in internal/exec/utils.go) and files are written to the component working directory via constructTerraformComponentPlanfilePath; generate-planfile writes JSON/YAML variants (<stack>-<component>.planfile.json/.yaml) and the --from-plan/--planfile/--skip-planfile/-out behaviors match the docs.

website/docs/cli/commands/terraform/terraform-metadata.mdx (1)

2-6: Incorrect — atmos terraform metadata exists in the CLI; this review is not applicable.

The subcommand is registered and implemented: cmd/terraform_commands.go (Use: "metadata") and cmd/list_metadata.go (command implementation). Screengrabs/tests also reference the command.

Likely an incorrect or invalid review comment.

website/docs/cli/commands/terraform/terraform-logout.mdx (1)

16-28: Align terraform-logout docs with actual CLI behavior

The code registers logout as a terraform subcommand and Atmos runs init/workspace handling by default; --skip-init and --dry-run are real persistent flags (see cmd/terraform_commands.go, internal/exec/terraform.go, internal/exec/terraform_utils.go). The page’s “pure passthrough” claim is inaccurate. Either:

  • Update website/docs/cli/commands/terraform/terraform-logout.mdx to remove the “pure passthrough” text and document that Atmos runs init/workspace by default (and keep --skip-init/--dry-run), or
  • Change the CLI to treat logout as global (skip stack/component processing and avoid running init/workspace selection) and then update the docs/help accordingly.

…pages

- Fix planfile extension consistency in planfiles.mdx (use .planfile throughout)
- Update State Locking description to clarify planfiles record state version but don't enforce locks
- Remove conflicting id from terraform-version.mdx frontmatter
- Update --skip-init flag documentation in terraform-version.mdx
- Add missing resource_address argument to terraform-untaint.mdx
- Fix --affected example in terraform-plan.mdx to show global usage
- Add optional hostname parameter to terraform-login.mdx
- Fix grammar in terraform-login.mdx Native Terraform Flags section
- Add required ADDRESS and ID arguments to terraform-import.mdx
- Replace incorrect "Skip Module Download" with "Suppress Color Output" in terraform-get.mdx
- Add required lock-id argument to terraform-force-unlock.mdx
- Fix Native Terraform Flags section in terraform-force-unlock.mdx
- Fix broken links in terraform-init.mdx Related Commands section

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update the usage example to include the required resource_address positional
argument and show how to pass native Terraform flags using the -- separator.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Sep 23, 2025
Remove terraform-commands.txt helper file that is not needed in the repository.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…tmos-specific

- Replace all :::note purpose blocks with <Intro> blocks across Terraform command docs
- Update descriptions to be more Atmos-specific, mentioning components and stacks
- Ensure all descriptions clarify operations are performed on Atmos components in stacks
- Make the documentation consistent across all Terraform command pages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add generate-terraform-help.sh script for creating screengrabs
- Generate screengrabs for all new Terraform commands:
  - apply, console, destroy, fmt, force-unlock, get, graph, import, init
  - login, logout, metadata, modules, output, plan, plan-diff, providers
  - refresh, show, state, taint, test, untaint, validate, version
- Screengrabs are HTML files generated from command help output
- Files are placed in website/src/components/Screengrabs/ for use in documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mergify
Copy link

mergify bot commented Nov 22, 2025

💥 This pull request now has conflicts. Could you fix it @osterman? 🙏

@mergify mergify bot added the conflict This PR has conflicts label Nov 22, 2025
Merged latest changes from main including AWS SSO identity auto-provisioning feature.

Resolved conflict by accepting theirs for golden snapshot:
- tests/snapshots/TestCLICommands_atmos_auth_login_--help.stdout.golden

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@osterman
Copy link
Member Author

Merge Conflicts Resolved ✅

All merge conflicts with main have been successfully resolved and pushed.

What was merged:

  1. CommandProvider interface - Combined both patterns:

    • Flag handler methods: GetFlagsBuilder(), GetPositionalArgsBuilder(), GetCompatibilityFlags()
    • Alias method: GetAliases()
  2. Updated all implementations:

    • Added flag handler methods to cmd/profile/profile.go (new from main)
    • Added GetAliases() to existing providers (list, theme, internal test mocks)
  3. Latest main changes - Merged AWS SSO identity auto-provisioning feature

CodeRabbit Review Status:

All review threads are resolved ✅. The review decision shows as "CHANGES_REQUESTED" but all comments have been addressed:

  • All 16 review threads show isResolved: true
  • The critical issues mentioned (terraform-deploy.mdx, terraform-init.mdx) don't exist in the current code
  • The review is based on an older commit; current commit is 5a6b9a39d

@coderabbitai please re-review to update the review status.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 23, 2025

@osterman Thank you for resolving the merge conflicts and addressing all review comments! I can confirm that all 16 review threads are marked as resolved.

I'll trigger a complete re-review of the current state of the PR to update the review status and ensure everything looks good after the merge.


🧠 Learnings used
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.

Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.

Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.

Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.
✅ Actions performed

Full review triggered.

coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 23, 2025
The help output format changed after merging main. Regenerated the snapshot
to match the current output format.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@osterman osterman changed the title docs: add comprehensive Terraform planfile documentation feat: merge flag handler pattern with command alias pattern in CommandProvider interface Nov 23, 2025
@osterman osterman changed the title feat: merge flag handler pattern with command alias pattern in CommandProvider interface docs: add comprehensive Terraform planfile documentation and command reference Nov 23, 2025
@aknysh aknysh merged commit 8f1fe66 into main Nov 24, 2025
113 checks passed
@aknysh aknysh deleted the custom-planfile branch November 24, 2025 17:34
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Nov 24, 2025
osterman added a commit that referenced this pull request Nov 24, 2025
Resolved merge conflicts by combining changes from both branches:

- .gitignore: Combined scratch file patterns from both branches
- CLAUDE.md: Accepted comprehensive main branch documentation
- cmd/testing_helpers_test.go: Merged both snapshot fields (os std streams + color profile)
- pkg/pager/pager.go: Combined writeContent method with isTTYAccessible check
- pkg/pager/pager_test.go: Accepted main branch test updates
- pkg/ui/formatter.go: Kept Reset() function and added color profile configuration
- Snapshots: Accepted main branch golden files

Changes from main:
- docs: Add comprehensive Terraform planfile documentation (#1498)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/xl Extra large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants