Repository navigation
feat: Support .tofu files - #247
Conversation
Builds on the .tofu discovery from #245. Tagged output keeps the input extension (main.tofu -> main.terratag.tofu) so a main.tf/main.tofu twin pair no longer races to write the same main.terratag.tf, and OpenTofu's twin precedence still holds after tagging. Re-runs skip *.terratag.tofu as well as *.terratag.tf. Adds tofu_file, tofu_file_with_tf_twin and tofu_already_tagged fixtures, unit tests for discovery and rename, and README notes for .tofu.
SummaryTerratag now discovers Review✅ SAFE TO MERGEThe change is small and matches the repo's patterns. The one thing to tidy is help text in Testing: Good. The root path table is met (new fixtures under Nice to have
Files reviewed (24)
Stack: Go CLI · kinds reviewed: code, tests, fixtures, docs · repo guidance: AGENTS.md |
VERDICT✅ SAFE — NO DEFECTS FOUND 0 ❌ failed · 8 ✅ passed · 1 🚫 blocked (terragrunt, covered-by-CI) Metadata: target local binary built from head ( Assumptions: CI mode ( LEADSCLAIMS: discover CHECKS
FINDINGS🔴 BROKENNone. 🟠 RISKYNone. 🟡 NOTE
RULED OUT
NOT COVERED
PROPOSED
FOR THE REPO
DETAILSTHE PLAYBOOK QUESTION, ANSWEREDNone fitted (Go CLI file discovery and renaming). Question I used: does a EXISTING TESTS RUN
TESTS WRITTEN FOR THIS RUNNone; probes were direct binary runs.
GENERATED DIFFSNone (no render layer involved: no template consumes these paths). CHECKS AGAINST THE TARGETTwin run on head (excerpt): Run totals: 10 checks run (8 ✅, 1 🚫 covered-by-CI, 1 P1 CI-status read), findings 0 🔴 · 0 🟠 · 2 🟡. |
erezrokah
left a comment
There was a problem hiding this comment.
The top two to fix before merge, both small:
- The Terragrunt walk picks up directories named
*.tofu. Fix: add a!d.IsDir()check. - The skip check has no leading dot, so a user file like
myterratag.tofuis never tagged. Fix: match.terratag.tofu.
|
|
SummaryTerratag now discovers Review✅ SAFE TO MERGEThe logic is correct and small; discovery, naming and skip all handle Testing: Good. Unit tests cover discovery per mode and output naming, and new fixtures are registered in Nice to have
Files reviewed (28)
Stack: Go CLI · kinds reviewed: code, tests, fixtures, docs · repo guidance: AGENTS.md, CLAUDE.md |
VERDICT✅ SAFE — NO DEFECTS FOUND 0 ❌ failed · 9 ✅ passed · 1 🚫 blocked (terragrunt, covered-by-CI) Metadata: target local binary built from head ( Assumptions: CI mode ( LEADSCLAIMS: discover CHECKS
FINDINGS🔴 BROKENNone. 🟠 RISKYNone. 🟡 NOTE
RULED OUT
NOT COVERED
PROPOSEDNone needed; FOR THE REPO
DETAILSTHE PLAYBOOK QUESTION, ANSWEREDNone fitted. Question used: is a EXISTING TESTS RUN
TESTS WRITTEN FOR THIS RUNNone; direct binary probes. Gate 2 for the skip-suffix fix: fc34f02 build on GENERATED DIFFSNone (no template consumes these paths; render n/a not implied). CHECKS AGAINST THE TARGETPrior-report checks re-run: twin outputs, re-run skip, Run totals: 10 checks run (9 ✅, 1 🚫 covered-by-CI); findings 0 🔴 · 0 🟠 · 3 🟡 (all resolved). |
Summary
This PR builds on #245 by @luroden, who found the gap and added
.tofudiscovery. Their commits are kept on this branch. This PR adds the output naming, the re-run skip and the fixtures on top.Terratag only discovered
*.tffiles, so resources in OpenTofu*.tofufiles were never tagged. This PR discovers*.tofufiles interraform,terragruntandterragrunt-run-allmodes. Tagged output keeps the input file extension.Changes
*.tofualongside*.tfinGetFilePaths(from feat: support .tofu files #245).main.tofubecomesmain.terratag.tofu. Before, amain.tf/main.tofutwin pair both wrotemain.terratag.tf. OpenTofu's rule that.tofutakes precedence over a same-named.tfstill holds after tagging.*.terratag.tofuas well as*.terratag.tfon re-runs..tofuhandling for-dir,-skipTerratagFilesand-rename.tofu_file,tofu_file_with_tf_twinandtofu_already_tagged, added toterraform_latest(so they also run underTestOpenTofu). Add a.tofufile toterragrunt_unit.TestGetFilePathsIncludesTofuFiles,TestReplaceWithTerratagFileKeepsExtension.Testing
SKIP_INTEGRATION_TESTS=1 go test ./...go vet ./...go fmt ./...TestTerraformlatest(Terraform 1.16.0)TestOpenTofu(OpenTofu 1.12.6)TestTerragruntWithCacheandTestTerragruntRunAll(Terragrunt 1.1.6, Terraform 1.16.0)