terragrunt
terragrunt copied to clipboard
Mock outputs being applied because they are appearing in saved plan files
Hi,
We run Terragrunt in our CI system by first doing a terragrunt run-all plan -out planfile
, then allowing an engineer to review the plan(s) before doing a terragrunt run-all apply planfile
to apply it.
We're running into an issue when applying modules that are dependent on one another and use mock outputs - the mock outputs are being saved to the plan file and when the apply runs it tries to apply the mock outputs rather than the actual outputs. This does make sense why this is happening - we're essentially telling Terragrunt to not run another plan by providing it a plan file, so of course it can only use the mock outputs.
Is there any workaround to this? For the moment we've just disabled saving the plan file and instead do a new plan at apply time, but this isn't ideal. I could conceive of a strategy where the saved plan file is somehow edited/updated by Terragrunt with the correct values at apply time, but I don't know if this is possible or suitable.
Not sure if relevant but we tend to use mock_outputs_merge_strategy_with_state = "deep_map_only"
for our dependency blocks.
We're using version v0.36.6 of Terragrunt.
Unfortunately there is no workaround for this, and this is one of the warnings we provide for using plan-all
/run-all plan
on a daily basis (see the callout in https://terragrunt.gruntwork.io/docs/reference/cli-options/#run-all).
Using plan files with run-all plan
is just something Terragrunt currently doesn't support, and is really hard to support given the limitations of Terraform's cross state capabilities.