Open robarthur opened 3 years ago
I tried an explicit include as well... and seeing similar behaviour:
e.g.
$ terragrunt run-all destroy --terragrunt-include-dir ${PWD}
Module /aws/customer-account/transit_gateway_attachment depends on module /aws/networking-account/transit_gateway, which is an external dependency outside of the current working directory. Should Terragrunt run this external dependency? Warning, if you say 'yes', Terragrunt will make changes in /aws/networking-account/transit_gateway as well! (y/n) n
Module /aws/networking-account/transit_gateway depends on module /aws/networking-account/vpc, which is an external dependency outside of the current working directory. Should Terragrunt run this external dependency? Warning, if you say 'yes', Terragrunt will make changes in /aws/networking-account/vpc as well! (y/n) n
Edit:
Seeing the same behaviour with --terragrunt-strict-include
Hm, that's odd. --terragrunt-ignore-external-dependencies
should do what you want...
Could you turn up the log level and share the full log output?
@brikis98 Thanks for getting back. I turned the log level down to debug, see below. I redacted slightly less info this time, but hopefully it's still clear/relevant to the example above:
ubuntu@iboy:~/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application$ terragrunt run-all destroy --terragrunt-ignore-external-dependencies --terragrunt-log-level DEBUG
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Evaluated 1 locals (remaining 0): environment_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1]
DEBU[0000] Evaluated 1 locals (remaining 0): aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa]
DEBU[0000] Evaluated 3 locals (remaining 0): account_name, aws_account_id, aws_profile prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa]
DEBU[0000] Evaluated 3 locals (remaining 3): region_vars, environment_vars, account_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment]
DEBU[0000] Evaluated 3 locals (remaining 0): account_name, account_id, aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment]
DEBU[0000] Setting download directory for module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment to /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment/.terragrunt-cache
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1]
DEBU[0000] Evaluated 1 locals (remaining 0): aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa]
DEBU[0000] Evaluated 3 locals (remaining 0): aws_account_id, aws_profile, account_name prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Evaluated 3 locals (remaining 0): region_vars, account_vars, environment_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa]
DEBU[0000] Evaluated 3 locals (remaining 0): aws_account_id, aws_profile, account_name prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1]
DEBU[0000] Evaluated 1 locals (remaining 0): aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1]
DEBU[0000] Evaluated 3 locals (remaining 3): environment_vars, account_vars, region_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc]
DEBU[0000] Evaluated 3 locals (remaining 0): account_name, account_id, aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc]
DEBU[0000] Setting download directory for module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc to /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc/.terragrunt-cache
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 1 locals (remaining 0): environment_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking]
DEBU[0000] Evaluated 3 locals (remaining 0): account_name, aws_account_id, aws_profile prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1]
DEBU[0000] Evaluated 1 locals (remaining 0): aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 3 locals (remaining 3): account_vars, region_vars, environment_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway]
DEBU[0000] Evaluated 3 locals (remaining 0): aws_region, account_name, account_id prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway]
DEBU[0000] Setting download directory for module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway to /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway/.terragrunt-cache
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 1 locals (remaining 0): environment_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking]
DEBU[0000] Evaluated 3 locals (remaining 0): account_name, aws_account_id, aws_profile prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1]
DEBU[0000] Evaluated 1 locals (remaining 0): aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1]
DEBU[0000] Found locals block: evaluating the expressions. prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 1 locals (remaining 0): environment prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress]
DEBU[0000] Evaluated 3 locals (remaining 3): account_vars, region_vars, environment_vars prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc]
DEBU[0000] Evaluated 3 locals (remaining 0): account_name, account_id, aws_region prefix=[/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc]
DEBU[0000] Setting download directory for module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc to /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc/.terragrunt-cache
INFO[0000] Stack at /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application:
=> Module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway (excluded: false, dependencies: [/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc])
=> Module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/vpc (excluded: false, dependencies: [])
=> Module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/transit_gateway_attachment (excluded: false, dependencies: [/home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/networking/us-east-1/egress/transit_gateway, /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc])
=> Module /home/ubuntu/Code/lib/infrastructure-as-code/terraform/aws/py3testa/us-east-1/application/vpc (excluded: false, dependencies: [])
Hey @brikis98 I was wondering if there's was any more you could glean from he output above or anything you'd recommend trying?
Hm, that does seem like a bug. Unfortunately, I can't see from the log output what the cause is. We're buried at the moment, so if anyone has time to dig into this, a PR is very welcome.
Terraform version:
Terraform v0.14.2
Terragrunt version:terragrunt version v0.28.7
I'm seeing unexpected behaviour when I try to use the following flags with either a
run-all
or adestroy-all
:Specifically I can't prevent dependencies that are outside of my current working directory from being included in
*-all
commands.I have a setup that looks like this:
The customer account transit-gateway-attachment has dependencies on the networking account VPC and Transit Gateway. But when if I run a
terragrunt run-all destroy
from theaws/customer-account/
directory, I don't want to destroy any resources in the networking account.What I tried (some info modified/redacted...):
I'd expect, based on the docs that in both cases those external dependencies would be excluded? It's possible in the first instance that those dependencies would have been excluded, but the output makes me think they wouldn't be..
(excluded: false
)