From a9bff7a23a94b3b7aa04565419c29030fddd2e21 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Tue, 31 Oct 2023 23:23:41 +0100 Subject: [PATCH] Add option for speculative plans --- tool.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tool.sh b/tool.sh index a60893b..3598a48 100644 --- a/tool.sh +++ b/tool.sh @@ -9,6 +9,12 @@ then else auto_approve="" fi -TF_TOKEN_app_terraform_io=$PLUGIN_API_TOKEN terraform apply -input=false"$auto_approve" +if [ "$PLUGIN_SPECULATIVE" = "true" ] +then + command="plan" +else + command="apply" +fi +TF_TOKEN_app_terraform_io=$PLUGIN_API_TOKEN terraform "$command" -input=false"$auto_approve" TF_TOKEN_app_terraform_io=$PLUGIN_API_TOKEN terraform output -json > "$working_dir/terraform_output" cd "$working_dir" || exit 1