-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (59 loc) · 1.91 KB
/
plan-app.yaml
File metadata and controls
62 lines (59 loc) · 1.91 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Plan application deployment
on:
push:
branches-ignore:
- main
repository_dispatch:
types:
- plan-app
workflow_dispatch:
inputs:
application:
description: Application to plan.
required: true
type: string
environment:
description: Environment to plan on.
default: development
required: true
type: environment
permissions:
contents: read
jobs:
plan:
name: Plan deploy of ${{ inputs.application }} to ${{ inputs.environment }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
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' }}
steps:
- name: "DEBUG: Dump inputs"
uses: imesense/gha-echo-action@v0.2
with:
input-string: ${{ toJson(inputs) }}
- name: "DEBUG: Dump payload"
uses: imesense/gha-echo-action@v0.2
with:
input-string: ${{ toJson(github.event.client_payload) }}
- 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.environment }}/infra
run: tofu init
- name: Plan changes
working-directory: ./tofu/config/${{ inputs.environment }}/infra
run: tofu plan --target module.app\[\"${{ inputs.application }}\"]
- name: Display plan
uses: imesense/gha-echo-action@v0.2
with:
input-string: ${{ steps.plan.outputs.stdout }}