coinbase / terraform-landscape

Improve Terraform's plan output to be easier to read and understand
Apache License 2.0
1.59k stars 116 forks source link

[feature required] support terragrunt plan output #56

Closed ozbillwang closed 6 years ago

ozbillwang commented 6 years ago

I am really addicted with terraform-landscape for nicer output. But recently I switch one project to use terragrunt, it makes the jobs easier to manage different aws accounts and environments.

But when run terragrunt plan | landscape, I can't get proper result. Changed colour but didn't reduce the unchange output.

I understand terragrunt plan has different output in front of lines, can you adjust or add option to support terragrunt output as well.

For quick start and duplicate the problem, check out the terragrunt-infrastructure-modules-example and terragrunt-infrastructure-live-example repos for fully-working sample code that demonstrates how to use Terragrunt.

Really appreciated.

sds commented 6 years ago

Hey @ozbillwang, we don't use Terragrunt internally. If you can add support for it without introducing significant complexity and preserving existing behavior, we'd be open to merging a pull request.

However, I'll be closing this as we have no intention of adding support for this ourselves. Thanks!

udondan commented 5 years ago

@ozbillwang There is an easy solution to this.

Create an executable file like this:

#!/bin/bash

if [[ "$1" = "plan" ]]; then
    terraform "$@" | landscape
else
    terraform "$@"
fi

Store it as /usr/local/bin/tfbeautify or wherever you want to put it.

Then tell terragrunt to use this wrapper by exporting a var like this:

export TERRAGRUNT_TFPATH="/usr/local/bin/tfbeautify"
ozbillwang commented 5 years ago

It works, thanks a lot