Open ilyasotkov opened 6 years ago
Check this out: https://github.com/coinbase/terraform-landscape
That's really cool. Would be great to integrate into Terragrunt :)
@brikis98 I just tested and you can just pipe terragrunt into landscape. terragrunt plan | landscape
Sweet!
@davidneudorfer Hmm that didnt work for me on MacOS. Piping everything into "landscape" hides all terraform output and I'm just left with terragrunts output. I have the latest version of each tool as well.
[terragrunt] 2019/01/15 12:27:11 Running command: terraform plan
No changes.
@yuriydee I just updated to the latest versions and everything still works.
terragrunt version v0.17.4 Terraform v0.11.11 Terraform Landscape 0.2.2
@davidneudorfer I took another look and yeah it actually works. So turns out landscape doesnt work when you have no infra changes and it truncates the output to just one line. But when I am removing/adding resources it works for me with both terraform and terragrunt.
The landscape will require ruby and it will increase my pipeline docker image. I wrote this simple solution to help me for now, at least to help us to see errors and visualize the changes.
```bash #!/bin/bash BOLD=$(tput bold) BLACK=$(tput setaf 0) RED=$(tput setaf 1) GREEN=$(tput setaf 2) YELLOW=$(tput setaf 3) BLUE=$(tput setaf 4) CYAN=$(tput setaf 6) RESET=$(tput sgr0) REDBOLD=${RED}${BOLD} REDRESET=${RESET}${RED} BLUEBOLD=${BLUE}${BOLD} BLUERESET=${RESET}${BLUE} terragrunt ${*} 2>&1 | sed \ -e "s/\(\\[terragrunt\\] \\[.*\\]\)\( [0-9\\/]* [0-9:]*\) /${BLUEBOLD}\1${BLUERESET}\2${RESET} /" \ -e "s/\(\\[terragrunt\\]\)\( [0-9\\/]* [0-9:]*\) /${BLUEBOLD}\1${BLUERESET}\2${RESET} /" \ -e "s/\(Error: \)\(.*\)/${REDBOLD}\1${REDRESET}\2${RESET}/" \ -e "s/\(Hit multiple errors:\)/${REDBOLD}\1${RESET}/" \ -e "s/\(exit status 1\)/${RED}\1${RESET}/" \ -e "s/\( WARNING: \)\(.*\)/${YELLOW}${BOLD}\1${RESET}${YELLOW}\2${RESET}/" \ -e "s/\( Running command: \)\(.*\)/\1${CYAN}\2${RESET}/" \ -e "s/\( *.*: *\)\(\".*\"\)\( => \)\(\".*\"\)/${YELLOW}\1${RED}\2${BLACK}\3${GREEN}\4${RESET}/" \ -e "s/\( *.*: *\".*\"\)/${GREEN}\1${RESET}/" ```
./terragrunt_color plan-all
It'd be a better user experience if the output of
terragrunt apply(-all)
:would produce green-colored output when it's a success (exit 0), and red-colored output when it's a failure (exit 1).
Same for
terragrunt destroy
, of course.