Closed ivasilyev-servicetitan-com closed 4 years ago
what happens if you just run terragrunt show -json plan > plan.json
(without the quotes)?
In that case it will run
[terragrunt] 2019/12/02 09:36:10 Running command: terraform show -json plan
and then will pipe terragrunt's output out into plan.json file - that's not what I need.
I managed to do what I need with the following after_hook
after_hook "after_hook_plan" {
commands = ["plan"]
execute = ["sh", "-c", "terraform show -json plan > plan.json"]
}
Terragrunt stdout is terraform stdout, so it should work. Actual terragrunt logging is wired to stderr... But, glad you got it working either way.
In the newer versions you can doe
terragrunt run-all show -json plan
@dverbeek84 it doesn't help to have all plans in one massive file.
As a small addition you can scope this to run on non-windows, since sh
is not supported. This is now possible using conditionals and get_platform.
after_hook "after_hook_plan" {
# Windows does not support 'sh' commands, skip this step
commands = get_platform() != "windows" ? ["plan"] : []
execute = ["sh", "-c", "terraform show -json plan > plan.json"]
}
Hello.
I'm trying to get simplified output of terraform with the help of terraform-plan-reviewer and Terragrunt.
Basically, I'm running
terragrunt plan-all -out=plan
to generate plan files on every folder with TF files. Then I need to applyterraform show -json plan > plan.json
but with the help of Terragrunt. I'm trying to runterragrunt "show -json plan > plan.json"
at least in one folder but get the followingIs there a way to do this with Terragrunt? I also looked at TG Hooks - but it doesn't look to be helpful in this scenario.