Skip to content

Commit

Permalink
allow overriding the environment via input
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Sep 17, 2024
1 parent 3a90e6d commit bf3d4a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
description: the terraform operation to perform (apply or destroy)
type: string
required: false
github_environment:
description: override the environment to apply the terraform operation to
type: string
required: false
secrets:
AWS_ACCESS_KEY_ID:
required: false
Expand Down Expand Up @@ -42,8 +46,11 @@ jobs:
environment="production"
elif [ "$BRANCH_LOWER" == "develop" ]; then
environment="develop"
elif [ -n "${{ inputs.github_environment }}" ]
then
environment="${{ inputs.github_environment }}"
else
echo "$BRANCH_LOWER doesn't have a matching environment"
echo "current branch doesn't have a matching environment and no environment override was provided"
exit 1
fi
echo "environment_name=${environment}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit bf3d4a0

Please sign in to comment.