1.6.7 #6
Workflow file for this run
This file contains hidden or 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
| name: "Deploy - Prod" | |
| run-name: "${{ github.event.inputs.git_tag }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| git_tag: | |
| description: "Git tag to deploy" | |
| required: true | |
| type: "string" | |
| permissions: | |
| pull-requests: write | |
| id-token: write # This is required for requesting the JWT | |
| contents: read # This is required for actions/checkout | |
| jobs: | |
| terraform_plan_apply: | |
| name: Terraform Plan/Apply (prod) | |
| runs-on: ubuntu-latest | |
| environment: prod | |
| steps: | |
| - name: Checkout Tag | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: refs/tags/${{ github.event.inputs.git_tag}} | |
| fetch-depth: "0" | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v5 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }} | |
| role-skip-session-tagging: true | |
| aws-region: ${{ vars.AWS_REGION }} | |
| mask-aws-account-id: true | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.13.3 | |
| terraform_wrapper: false | |
| - name: Initialise Terraform | |
| id: init | |
| run: terraform init -backend-config=backend-prod.conf | |
| working-directory: ./infrastructure | |
| shell: bash | |
| - name: Select Terraform Workspace | |
| id: workspace | |
| run: terraform workspace select ${{ secrets.AWS_WORKSPACE }} | |
| working-directory: ./infrastructure | |
| shell: bash | |
| - name: Check Terraform Formatting | |
| run: terraform fmt -check | |
| working-directory: ./infrastructure | |
| - name: Run Terraform Plan | |
| id: plan | |
| run: | | |
| terraform plan -input=false -no-color -var-file="${{vars.TF_VARS_FILE}}" -out tf.plan | |
| working-directory: ./infrastructure | |
| shell: bash | |
| - name: Run Terraform Apply | |
| run: terraform apply -auto-approve -input=false tf.plan | |
| working-directory: ./infrastructure |