Skip to content

Deploy infrastructure #9

Deploy infrastructure

Deploy infrastructure #9

Workflow file for this run

name: Deploy infrastructure
on:
workflow_dispatch:
inputs:
config:
description: Configuration to deploy.
required: true
type: choice
options:
- foundation
- networking
- docs
environment:
description: Environment to deploy to.
default: development
required: true
type: environment
permissions:
contents: read
jobs:
deploy:
name: Deploy ${{ inputs.config }} to ${{ inputs.environment }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
# Set required secrets and variables.
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ vars.AWS_REGION || 'us-east-1' }}
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
TF_VAR_public_subnet_cidrs: ${{ secrets.TF_VAR_PUBLIC_SUBNET_CIDRS }}
TF_VAR_private_subnet_cidrs: ${{ secrets.TF_VAR_PRIVATE_SUBNET_CIDRS }}
TF_VAR_vpc_cidr: ${{ secrets.TF_VAR_VPC_CIDR }}
TF_VAR_environment: ${{ vars.TF_VAR_ENVIRONMENT }}
TF_VAR_program: ${{ vars.TF_VAR_PROGRAM }}
TF_VAR_project: ${{ vars.TF_VAR_PROJECT }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Setup OpenTofu
uses: ./.github/actions/setup-opentofu
with:
config: ${{ inputs.config }}
- name: Apply changes
working-directory: ./tofu/config/${{ inputs.config }}
run: tofu apply --auto-approve