diff --git a/terraform-actions/main.sh b/terraform-actions/main.sh index 1c695e3..ad5ea50 100755 --- a/terraform-actions/main.sh +++ b/terraform-actions/main.sh @@ -12,9 +12,6 @@ export TF_IN_AUTOMATION=true workingDir="$2" function main { command="$1" - firstWord=$(echo ${command} | cut -d' ' -f1) - remainingArgs=$(echo ${command} | cut -d' ' -f2-) - scriptDir=$(dirname ${0}) source ${scriptDir}/apply.sh source ${scriptDir}/fmt.sh @@ -22,21 +19,21 @@ function main { source ${scriptDir}/plan.sh source ${scriptDir}/validate.sh - case "${firstWord}" in + case "${command}" in apply) - terraformApply ${remainingArgs} + terraformApply ;; fmt) - terraformFmt ${remainingArgs} + terraformFmt ;; init) - terraformInit ${remainingArgs} + terraformInit ;; plan) - terraformPlan ${remainingArgs} + terraformPlan ;; validate) - terraformValidate ${remainingArgs} + terraformValidate ;; *) echo "Error: Unrecognized command ${command}"