Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Terragrunt Catalog lists tofu test modules/helpers #3378

Open
RBurot opened this issue Sep 3, 2024 · 4 comments
Open

Terragrunt Catalog lists tofu test modules/helpers #3378

RBurot opened this issue Sep 3, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@RBurot
Copy link

RBurot commented Sep 3, 2024

Describe the bug

When I launch terragrunt catalog command, all modules are presents including fixture module for testing

Steps To Reproduce

I write ready-to-use catalog for my team

I design a module and I implement test with opentofu test method https://opentofu.org/docs/cli/commands/test/

To do the endtoend test, I create a fixture module to have helpers (in the setup folder):
├── README.md
├── locals.tf
├── main.tf
├── outputs.tf
├── tests
│   ├── main.tftest.hcl
│   └── setup
│   └── main.tf
├── variables.tf
└── versions.tf

when I launch the terragrunt catalog command, the helper module for the test is listed

Expected behavior

I don't want to have fixtures or helpers modules listed or have a way to ignore helpers modules

Nice to haves

  • [ x] Terminal output
  • [ x] Screenshots
    image

image

Versions

  • Terragrunt version: terragrunt version v0.67.0
  • OpenTofu/Terraform version: OpenTofu v1.8.1 on linux_amd64
  • Environment details (Ubuntu 20.04, Windows 10, etc.): WSL Ubuntu 22.04

Additional context

the only workaround way I found is to externalize fixture or helpers test modules from root modules folder

@RBurot RBurot added the bug Something isn't working label Sep 3, 2024
@josh-padnick
Copy link
Contributor

@yhakbar This is worth generally prioritizing. Let's also discuss this in more detail when we focus on the upcoming Catalog project in the roadmap.

@yhakbar
Copy link
Collaborator

yhakbar commented Sep 3, 2024

@josh-padnick Sounds good. I think we can design something that works nicely to offer the ability to ignore modules from repos or something. I think a .terragrunt-catalog-exclude file might be the pattern that does this best.

@RBurot ,
FYI, Gruntwork TF module repos all include tests directories as well, but we don't run into this issue because we generally don't put modules at the root of the repo. They are generally nested into a modules directory so that they're isolated from content like CI/CD configurations, etc.

This might be another way to work around this issue pending of a first class way to ignore content in module repos.

@RBurot
Copy link
Author

RBurot commented Sep 6, 2024

@yhakbar
It's the same in my case. (the complete repo tree):
image
I had focus on one module because the problem is linked to the module tests included inside the module

I think the .terragrunt-catalog-exclude file could be a great solution.

For the moment, I think the best way to do the job is to externalize out of root modules folder the test helpers modules. And at the end, I think it's the best way to do to DRY the helpers module too.

@josh-padnick
Copy link
Contributor

Just to throw another idea out there, we could also introduce a new configuration block (e.g. catalog) that allows you specify a RegEx of which directories you'd like to include in the list. I wonder if "opt in" works better here than "opt out".

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants