Open MichalKoziorowski-TomTom opened 9 months ago
It must be some threading issue or related to the order in which operations are performed in terragrunt.
If I replace the reference to working dir:
fileexists("${get_working_dir()}/config/region/${local.common_env_vars.inputs.cluster_region}.tfvars") ? ["${get_working_dir()}/config/region/${local.common_env_vars.inputs.cluster_region}.tfvars"] : [],
with just a path to config inside the terraform module:
fileexists("${get_terragrunt_dir()}/../../../terraform/applications/worker/config/region/${local.common_env_vars.inputs.cluster_region}.tfvars") ? ["${get_terragrunt_dir()}/../../../terraform/applications/worker/config/region/${local.common_env_vars.inputs.cluster_region}.tfvars"] : [],
then everything works. Otherwise, I need to apply two or three times.
Hello, I tried to reproduce issue in https://github.com/denis256/terragrunt-tests/tree/master/issue-2834
but I get same order of env var files:
DEBU[0000] Running command: terraform apply -var-file=/projects/gruntwork/terragrunt-tests/issue-2834/app2/.terragrunt-cache/yGqT3pr1MdNAZNBAC8k5-7p0Ylo/9QlQVibzYpXJB6lQ0M6kQ2UqmkA/us-east-1.tfvars -var-file=settings.tfvars -var-file=versions.tfvars -var-file=1.tfvars -var-file=2.tfvars -var-file=3.tfvars -auto-approve -input=false prefix=[/projects/gruntwork/terragrunt-tests/issue-2834/app2]
DEBU[0000] Running command: terraform apply -var-file=/projects/gruntwork/terragrunt-tests/issue-2834/app3/.terragrunt-cache/bZ0BH7tORY15OFNW9ZNEmYBH4aQ/V76B35WRaSTg7zFltX68X4Z0rt0/us-east-1.tfvars -var-file=settings.tfvars -var-file=versions.tfvars -var-file=1.tfvars -var-file=2.tfvars -var-file=3.tfvars -auto-approve -input=false prefix=[/projects/gruntwork/terragrunt-tests/issue-2834/app3]
can be shared repo there the issue happens?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue.
Describe the bug Multiple calls of terragrunt command produces different terraform commands.
I'm having list of locations in which I have var files with variables. I want them to be applied in a specific order so I can make variable value overrides. Not all of var files must exist, so I'm making checks and array concatenation inside required_var_files section.
This module is part of a more complex deployment, which is deployed using terragrunt run-all apply ... in root directory. The problem is that even though my file always exists, it sometimes appears in terraform apply command produced by terragrunt, and sometimes not. I've enabled debug option and see following produced terraform commands:
First call:
One of the next calls:
File that is sometimes added and sometimes not is located in terraform module I'm trying to deploy, in config/region/westeurope.tfvars location.
Expected behavior Consecutive terragrunt executions should produce same terraform command
Nice to have
Versions