terragrunt-local 672 B

123456789101112131415161718192021
  1. #! /bin/bash
  2. if [ ! -f terragrunt.hcl ]; then
  3. echo "ERROR: No terragrunt.hcl in this directory. Aborting."
  4. exit 1
  5. fi
  6. GITSOURCE=$( cat terragrunt.hcl | egrep -v '^ *#' | egrep 'source *= *.git@github\.mdr' )
  7. if [ "$GITSOURCE" == "" ]; then
  8. echo "ERROR: No source from MDR Git detected. Aborting."
  9. exit 2
  10. fi
  11. # Remove the git URL and the reference
  12. NEWPATH=$( echo $GITSOURCE | sed 's#^.*//#../../../../../xdr-terraform-modules//#' | sed 's/\?.*$//' )
  13. echo Substituting \'$GITSOURCE\' with \'$NEWPATH\'
  14. # Test locally
  15. # the double // is intentional! Terragrunt uses this to determine the root of the modules repository.
  16. terragrunt $* --terragrunt-source $NEWPATH