diff --git a/hooks/pre-command b/hooks/pre-command new file mode 100755 index 0000000..2e1452e --- /dev/null +++ b/hooks/pre-command @@ -0,0 +1,14 @@ +#!/bin/bash + +# if a pre-command has been specified, run it now +PRECOMMAND=${BUILDKITE_PLUGIN_TERRAFORM_PRECOMMAND:-false} + +if [ "$PRECOMMAND" != "false" ]; then + if [ -f "$PRECOMMAND" ]; then + # if it's a file, then just source it + source $PRECOMMAND + else + # otherwise, attempt to execute it directly + eval $PRECOMMAND + fi +fi diff --git a/plugin.yml b/plugin.yml index afb3281..5da730f 100644 --- a/plugin.yml +++ b/plugin.yml @@ -29,3 +29,5 @@ configuration: type: string workspace: type: string + precommand: + type: string