forked from hashicorp/terraform-github-actions
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
README.md, src/main.sh, test/local-test.sh: Support for 'run-all' opt…
…ions 1. test/local-test.sh: Added script to run local testing 2. README.md: Updated about local testing
- Loading branch information
1 parent
259fc9e
commit d4ab109
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
# This is a script for easily running the local testing | ||
# Comes very handy in local development | ||
|
||
TF_VERSION='0.14.6' | ||
TG_VERSION='v0.28.4' | ||
TF_WORKING_DIR='/var/opt' | ||
TF_SUBCOMMAND='run-all init' | ||
TG_LOCAL_WORK_DIR="$(pwd)" # TODO, provide some path which has the terragrunt code | ||
|
||
function build_docker { | ||
echo "INFO: Building docker image" | ||
docker build -t tg . | ||
} | ||
|
||
function run_docker { | ||
echo "INFO: Test running docker" | ||
docker run -it \ | ||
-e INPUT_TF_ACTIONS_VERSION=$TF_VERSION \ | ||
-e INPUT_TG_ACTIONS_VERSION=$TG_VERSION \ | ||
-e INPUT_TF_ACTIONS_SUBCOMMAND="$TF_SUBCOMMAND" \ | ||
-e INPUT_TF_ACTIONS_WORKING_DIR="$TF_WORKING_DIR" \ | ||
-v $TG_LOCAL_WORK_DIR:$TF_WORKING_DIR \ | ||
tg | ||
} | ||
|
||
function main { | ||
|
||
# validate cli | ||
if [ "$1" != "" ];then | ||
TF_SUBCOMMAND=$* | ||
fi | ||
|
||
# Build the image | ||
build_docker | ||
|
||
# test run it | ||
run_docker | ||
} | ||
|
||
main $* |