Open JustinYeoh93 opened 1 year ago
Hi,
was attempted to use --terragrunt-exclude-dir **/us-west-1
or --terragrunt-exclude-dir us-west-1/**
?
Hi there Denis,
Thank you very much for responding!
I've tried both your suggestions and it still takes the us-west-1
into consideration.
@denis256 Any updates on this issue?
I'm running into this same issue. Best I can tell, globstar [**
] is not something that works out of the box in golang. Glob [*
] will only work for 1 directory, as wildcard on paths will never include a slash.
So in this example, you're trying to exclude us-west-1
, but in the code it's looking for a module at path us-west-1
. There's no module at us-west-1, because the modules are us-west-1/networking/vpc
and us-west-1/cluster/eks
. Further, you couldn't do us-west-1/*
because that would only match one subdirectory. You could do us-west-1/*/*
, but if you have future levels of subdirectories, they wouldn't be excluded.
So... the [very annoying] way around this would be:
terragrunt run-all apply --terragrunt-exclude-dir 'us-west-1/*' --terragrunt-exclude-dir 'us-west-1/*/*' --terragrunt-exclude-dir 'us-west-1/*/*/*' --terragrunt-exclude-dir 'us-west-1/*/*/*/*' # ... etc
Or slightly more concisely but less readable:
terragrunt run-all apply --terragrunt-exclude-dir=us-west-1/{*,*/*,*/*/*,*/*/*/*}
Edit:
You could also do this using the native envvar splitter and the undocumented env var "TERRAGRUNT_EXCLUDE_DIR"
So it would look like:
export TERRAGRUNT_EXCLUDE_DIR="us-west-1/*,us-west-1/*/*,us-west-1/*/*/*,us-west-1/*/*/*/*"
terragrunt run-all apply
I'm seeing similar behavior with terragrunt run-all init
. I have a monorepo of internal modules that looks like this:
./aws-module-1
./aws-module-2
...
I'm setting the TERRAGRUNT_EXCLUDE_DIR
variable as described above:
export TERRAGRUNT_EXCLUDE_DIR='aws-module-1,aws-module-1/*,aws-module-1/*/*,aws-module-2,aws-module-2/*'
But when I execute the run-all init
command, I see the following in my pipeline logs:
msg=The stack at /builds/terraform-aws-modules will be processed in the following order for command init:
Group 1
- Module /builds/terraform-aws-modules/aws-module-1
- Module /builds/terraform-aws-modules/aws-module-2
- ...
Any ideas? I've also tried this with the CLI argument (--terragrunt-exclude-dir
) but was getting errors with the run-all init
.
It'd be nice if globstar was supported, or at least specifying a prefix as is desired in this case.
I'm trying to exclude a directory when I run terragrunt apply. But from what I've been trying
The command
terragrunt run-all apply --terragrunt-exclude-dir us-west-1
is to run everything except the directory in us-west-1. But as the pre-apply output below shows, it is still applying us-west-1.Any opinion on what I'm doing wrong would be much appreciated.