gruntwork-io / terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.
https://terragrunt.gruntwork.io/
MIT License
8.03k stars 971 forks source link

$TERRAGRUNT_INCLUDE_DIR env variable seems not support glob curly braces #3462

Open Neonox31 opened 1 week ago

Neonox31 commented 1 week ago

Describe the bug

Hello 👋

First, thanks for all you work on this awesome project 👍

I found a strange behavior with $TERRAGRUNT_INCLUDE_DIR environment variable, it does not seem to take into account curly braces in unix style globs, but using --terragrunt-include-dir seems working correctly.

FYI, using wildcards with env variable is working.

Is this behavior normal ?

Steps To Reproduce

TERRAGRUNT_INCLUDE_DIR="gcloud/{project-1,project-2}" terragrunt run-all init

Results with an empty output :

14:56:01.853 INFO   The stack at . will be processed in the following order for command init:

Expected behavior

14:57:58.123 INFO   The stack at . will be processed in the following order for command init:
Group 1
- Module ./gcloud/project-1
- Module ./gcloud/project-2

Versions

denis256 commented 1 week ago

Hello, use , to separate values passed through env variables

TERRAGRUNT_INCLUDE_DIR="gcloud/project-1,gcloud/project-2" terragrunt run-all init
Neonox31 commented 1 week ago

@denis256 Thanks for the workaround, but is it normal for the variable and the argument to function differently?

yhakbar commented 1 week ago

At the very least, the difference should be documented if they aren't (I haven't looked through the docs to confirm this).

Given that the workaround is fairly simple, I'm going to mark this issue as requesting community contributions, and marking it as preserved so that the issue doesn't go stale.

This is where flag splitting occurs, and where folks should start looking if they'd like to contribute a fix for this: https://github.com/gruntwork-io/terragrunt/blob/af89a982c98d50d8a0015016c70f311462d5c57f/pkg/cli/slice_flag.go#L162