Skip to content

fix: discover generate_projects dirs that only contain .tofu files - #2756

Open
sarankumar1325 wants to merge 1 commit into
diggerhq:developfrom
sarankumar1325:fix/generate-projects-tofu-files
Open

sarankumar1325 wants to merge 1 commit into
diggerhq:developfrom
sarankumar1325:fix/generate-projects-tofu-files

Conversation

@sarankumar1325

Copy link
Copy Markdown

Fixes #2727

What

generate_projects finds project dirs with FileSystemTopLevelTerraformDirWalker, which only looks for *.tf files. OpenTofu also loads *.tofu files, so a directory that only has .tofu files was skipped and no project was made for it.

This change makes the walker treat a directory as a project when it has .tf or .tofu files. Nothing else changes: the modules skip, include/exclude and nested-project handling all work as before.

Tests

  • Added TestDiggerGenerateProjectsWithTofuFiles. It builds dev/tf (with main.tf), dev/tofu (with main.tofu only) and dev/other (with no Terraform files), then checks that dev/tf and dev/tofu are both found. The test fails without the fix.
  • go test ./digger_config/... in libs passes, and so does go vet.

AI assistance disclosure

I used an AI assistant to help write this change (code and test) and this description. I reviewed the change and ran the tests myself.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate_projects does not discover projects that only contain .tofu files

1 participant