-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (86 loc) · 2.96 KB
/
apply.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Apply changes
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
jobs:
apply-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.0
terraform_wrapper: false
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true
- name: Terraform Init
id: init
run: terraform init
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: terraform plan -no-color
continue-on-error: false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
TF_VAR_system_token: ${{ secrets.KONNECT_SYSTEM_TOKEN }}
TF_VAR_cp_region: "au"
TF_VAR_exclude_mesh_control_plane: "true"
- name: Terraform Apply
id: apply
if: github.event_name == 'push'
run: terraform apply -no-color -auto-approve -input=false
continue-on-error: false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
TF_VAR_system_token: ${{ secrets.KONNECT_SYSTEM_TOKEN }}
TF_VAR_cp_region: "au"
TF_VAR_exclude_mesh_control_plane: "true"
- name: Generate terraform output
id: output
run: terraform output -no-color -json > ./konnectTFOutput.json
continue-on-error: false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tf-output
path: ./konnectTFOutput.json
update-tf-output-gist:
needs: apply-changes
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: tf-output
- name: Upload to Gist
uses: exuanbo/[email protected]
with:
token: ${{ secrets.GH_GIST_TOKEN }}
gist_id: ${{ secrets.GIST_ID }}
file_path: ./konnectTFOutput.json