Closed jtyr closed 1 year ago
I'm seeing exact same behaviour.
terragrunt --version
terragrunt version v0.45.0
terraform --version
Terraform v1.3.0
on darwin_arm64```
Hi @jtyr
Thank you for the detailed explanation, it was really helpful. Issue resolved in v0.45.17 release.
You also need to update the config file.
# terragrunt/terragrunt.hcl
locals {
org_vars = read_terragrunt_config("${get_parent_terragrunt_dir()}/org.hcl")
env_vars = read_terragrunt_config("${get_parent_terragrunt_dir()}/envs/dev/env.hcl")
tier_vars = read_terragrunt_config("tier.hcl")
...
}
...
Good luck!
I have the following setup:
Where the files content is as follows:
When I run
terragrunt apply
from theterragrunt/envs/dev/base
directory and then from theterragrunt/envs/dev/cluster
directory, all works just fine. But once I runterragrunt destroy
from theterragrunt/envs/dev/cluster
directory, I get an error the it cannot find files used in the includedterragrunt.hcl
but the destruction works just fine:But if I comment out the
dependency
related blocks from theterragrunt/envs/dev/cluster/terragrunt.hcl
file:the
terragrunt destroy
command is showing no error:It looks like when the
dependency
is used, it somehow evaluates thedestroy
command from the perspective of the includedterragrunt.hcl
file instead of from the perspective of the rootterragrunt.hcl
file.I tried to use the Terragrunt built-in functions (e.g.
get_terragrunt_dir
,get_parent_terragrunt_dir
,get_original_terragrunt_dir
,path_relative_to_include
,path_relative_from_include
) in the paths specified in theterraform
anddependency
blocks but nothing really helped.This issue is similar to #2330 and #1891 with the difference that I don't specify the
--terragrunt-working-dir
at all as I run the commands directly from the root module.