Skip to content

Terragrunt parsing support #843

Discussion options

You must be logged in to vote

I found that we can post the result of terragrunt with tfcmt by terragrunt --terragrunt-tfpath option.

  1. Create a wrapper script of terraform and make it executable
$ vi tfwrapper.sh
$ chmod a+x tfwrapper.sh

tfwrapper.sh

#!/bin/bash

set -euo pipefail

command=$1

base_dir=$(git rev-parse --show-toplevel) # Please fix if necessary
target=${PWD#"$base_dir"/}

if [ "$command" == "plan" ]; then
  tfcmt -var "target:${target}" plan -- terraform "$@"
elif [ "$command" == "apply" ]; then
  tfcmt -var "target:${target}" apply -- terraform "$@"
else
  terraform "$@"
fi
  1. Run terragrunt run-all with --terragrunt-tfpath
$ terragrunt run-all plan --terragrunt-tfpath "<absolute path of tfwrapper.sh>"

T…

Replies: 5 comments 18 replies

Comment options

You must be logged in to vote
3 replies
@suzuki-shunsuke
Comment options

@suzuki-shunsuke
Comment options

@zischknall
Comment options

Comment options

You must be logged in to vote
2 replies
@suzuki-shunsuke
Comment options

@suzuki-shunsuke
Comment options

Comment options

You must be logged in to vote
1 reply
@suzuki-shunsuke
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
12 replies
@zischknall
Comment options

@zischknall
Comment options

@suzuki-shunsuke
Comment options

@suzuki-shunsuke
Comment options

@zischknall
Comment options

Answer selected by suzuki-shunsuke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants