Skip to content

Feature request: OpenTofu (tofu) filter support #240

@Destynova2

Description

@Destynova2

Summary

tofu (OpenTofu) commands are among the heaviest unhandled commands in my RTK discover output -- 321 combined calls over 30 days across tofu fmt, tofu test, tofu apply, tofu validate, tofu output, tofu plan, and tofu init.

Discover output

tofu fmt                    88    tofu fmt
tofu test                   76    tofu test 2>&1
tofu apply                  56    AWS_ACCESS_KEY_ID=... tofu apply -auto-approve ...
tofu validate               37    tofu validate 2>&1
tofu output                 24    AWS_ACCESS_KEY_ID=... tofu output -json ...
tofu plan                   22    AWS_ACCESS_KEY_ID=... tofu plan ...
tofu init                   18    AWS_ACCESS_KEY_ID=... tofu init ...

Use cases

  • tofu plan / tofu apply -- very verbose output with full resource diffs, provider logs, and state refresh lines. Most of the output is "Refreshing state..." noise; only the actual plan summary and changes matter for LLM context
  • tofu test -- test runner output similar to go test, lots of boilerplate around pass/fail
  • tofu validate -- usually short on success ("Success! The configuration is valid.") but verbose on error with full HCL context blocks
  • tofu fmt -- no output on success, diff output on failure; minimal filtering needed
  • tofu output -json -- full JSON state dumps, often large when only a few values matter
  • tofu init -- provider download progress bars, plugin cache messages, backend config echo

Suggested filters

  • Strip all "Refreshing state..." lines from plan/apply (biggest single win)
  • Strip provider download progress from init
  • Compact plan output: keep resource change summary (+/- counts) and changed attributes, strip unchanged attributes
  • For apply: keep final summary ("Apply complete! Resources: X added, Y changed, Z destroyed") and any errors
  • For output -json: keep key/value pairs, strip metadata fields
  • For test: keep only pass/fail summary and failure details (same pattern as test runners)

Notes

  • OpenTofu is a drop-in replacement for Terraform -- tofu and terraform share the same CLI interface and output format. Supporting tofu would also cover terraform with minimal extra work (alias or shared filter logic)
  • Output format is identical between tofu and terraform, so a single filter implementation covers both

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions