-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (40 loc) · 1.29 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Deploy pipeline
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
default: 'staging'
required: true
type: environment
config:
description: 'The OpenTofu configuration to plan'
default: 'staging'
required: true
type: choice
options:
- staging
- production
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
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: opentofu/setup-opentofu@v1
- name: Initialize OpenTofu
working-directory: ./tofu/config/${{ inputs.config }}
run: tofu init
# TODO: Add a manual approval step here. For now, we'll use GitHub
# Actions' environment protection feature for sensitive environments.
- name: Apply changes
working-directory: ./tofu/config/${{ inputs.config }}
run: tofu apply --auto-approve