Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better support terragrunt plan/apply & plan-all/apply-all #1716

Open
dginzbourg opened this issue Jul 25, 2021 · 0 comments
Open

better support terragrunt plan/apply & plan-all/apply-all #1716

dginzbourg opened this issue Jul 25, 2021 · 0 comments
Labels

Comments

@dginzbourg
Copy link

Hi,
I created a custom workflow for terragrant and tried to use plan/apply-all, by passing $PLANFILE as parameter
workflows: terragrunt: plan: steps: - env: name: TERRAGRUNT_TFPATH command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"' - run: terragrunt plan-all --terragrunt-non-interactive -no-color -out $PLANFILE apply: steps: - env: name: TERRAGRUNT_TFPATH command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"' - run: terragrunt apply-all $PLANFILE --terragrunt-non-interactive -no-color

But I noticed that only the latest plan was applied. What happens is that terragrunt passes the same absolute file path to all the children and the latest plan wins. The simple solution was just let terragrunt work with file name only
workflows: terragrunt: plan: steps: - env: name: TERRAGRUNT_TFPATH command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"' - run: terragrunt plan-all --terragrunt-non-interactive -no-color -out default.tfplan apply: steps: - env: name: TERRAGRUNT_TFPATH command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"' - run: terragrunt apply-all "default.tfplan" --terragrunt-non-interactive -no-color

This works fine if run from the command line, but in Atlantis it worked only if run "atlantis -d

". After checking the code, I found out that there was a bug/limitation introduced as part of #487.
IMO, Atlantis code shouldn't have workarounds for specific terragrunt implementation or at least support flags to enable/disable different behavior.
That PR initially failed due to $PLANFILE example from Atlantis documentation. I suggest to fix the documentation (i.e. don't use $PLANFILE for terragrunt), add compatibility flag to support the current plan search logic and remove this exception (ignoring .terragrunt-cache) from the future versions.

@dosubot dosubot bot added the Stale label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant