terragrunt
terragrunt copied to clipboard
Terragrunt destroy dependency check including outside configuration
The purview of the feature added from https://github.com/gruntwork-io/terragrunt/issues/299 feels too broad. Do we really want to be checking every terragrunt.hcl
file in the git repo when running destroy
commands?
The issue I'm running into is that locals
are being evaluated for every terragrunt.hcl
file. For my configuration, this includes a run_cmd
that calls a script to package terraform code into s3 and return the path to be used as the terraform
source. It doesn't really make sense to do this for every terragrunt.hcl
my organization has defined when trying to destroy a particular terragrunt module. Also, the run_cmds
are failing because an environment variable the script depends on isn't set, for some reason, although it is set before calling terragrunt
.
Would it be worth adding a way to skip this functionality by default? Maybe a configuration attribute to turn the functionality off or a cli option to turn it on if it's off by default?
Hi, can be an option to add feature flags to change the default behavior
Facing a similar issue where a run_cmd command is executed for every project in a repo with a lot of projects. This really slows down the execution of the destroy command. Having a way to turn it off would be useful.
P.S. ended up doing terragrunt plan -destroy -out tf.plan; terragrunt apply tf.plan
as a workaround.
This is also an issue for us. In our case, we have separate directories for dev and prod environments and evaluating locals everywhere results in calls to an external service in the other environment which it doesn't have active credentials for.
We're using @velkovb 's workaround for now, but it would be good to be able to disable this behavior.
Another workaround:
terragrunt apply -destroy
Somehow, there seems to be a difference.. It's not only a convenience alias as terragrunt destroy --help
claims:
terragrunt destroy --help
Usage: terraform [global options] destroy [options]Destroy Terraform-managed infrastructure.
This command is a convenience alias for: terraform apply -destroy
Another workaround:
terragrunt apply -destroy
Somehow, there seems to be a difference.. It's not only a convenience alias as
terragrunt destroy --help
claims:terragrunt destroy --help Usage: terraform [global options] destroy [options] Destroy Terraform-managed infrastructure. This command is a convenience alias for: terraform apply -destroy
Hi,
We have the same problem after migration from terragrunt version v0.36.1 to v0.53.2.
And can confirm that using terragrunt apply -destroy
instead of terragrunt destroy
solves it.
Also terragrunt destroy
should be made to behave like terragrunt apply -destroy
because otherwise it causes problems like the ones already described.