Manual - Apply changes #17
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: Manual - Apply changes | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: choice | |
description: Which environment to deploy to | |
required: true | |
default: staging | |
options: | |
- staging | |
- production | |
jobs: | |
terraform_deployment: | |
environment: ${{ inputs.environment }} # secrets are set per environment | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TF_VAR_azure_vpn_gateway_tunnel1_preshared_key: ${{ secrets.AZURE_VPN_GATEWAY_PRESHARED_KEY1 }} | |
TF_VAR_azure_vpn_gateway_tunnel2_preshared_key: ${{ secrets.AZURE_VPN_GATEWAY_PRESHARED_KEY2 }} | |
TF_VAR_azure_vpn_gateway_tunnel1_ip_address: ${{ secrets.AZURE_VPN_GATEWAY_TUNNEL1_IP_ADDRESS }} | |
runs-on: ubuntu-latest | |
name: Manual terraform apply | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Configure Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Terraform format check | |
run: terraform fmt -check -diff -recursive | |
- name: Initialize Terraform | |
run: terraform init -backend-config="./${{ inputs.environment }}.config" # use branch name as deployment environment | |
- name: Run Terraform Plan | |
run: | | |
terraform plan -input=false -var-file="${{ inputs.environment }}.tfvars" -out plan.tfplan >/dev/null && terraform show plan.tfplan | |
- name: Run Terraform Apply | |
run: | | |
terraform apply -input=false -auto-approve -var-file="${{ inputs.environment }}.tfvars" |