forked from mage-os/terraform
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.26 KB
/
terraform-apply.yml
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
name: "Terraform apply"
concurrency: terraform-ci
on:
push:
paths-ignore:
# YAML anchors doesn't seem to work in GitHub Actions, so we have to copy
# this field.
- .gitignore
- "*.md"
- CODEOWNERS
branches:
- main
jobs:
terraform-apply:
name: "Terraform apply"
runs-on: ubuntu-latest
env:
# Google Cloud Storage state backend
GOOGLE_APPLICATION_CREDENTIALS_DATA: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_DATA }}
GOOGLE_APPLICATION_CREDENTIALS: '/tmp/tf-google-application-credentials.json'
# GitHub provider
TF_VAR_app_node_id: ${{ secrets.TF_VAR_APP_NODE_ID }}
TF_VAR_github_app_id: ${{ secrets.GH_APP_ID }}
TF_VAR_github_app_installation_id: ${{ secrets.GH_APP_INSTALLATION_ID }}
TF_VAR_github_app_pem_file: ${{ secrets.GH_APP_PEM_FILE }}
steps:
- name: Write GCS credentials
run: echo $GOOGLE_APPLICATION_CREDENTIALS_DATA > $GOOGLE_APPLICATION_CREDENTIALS
- name: Checkout
uses: actions/checkout@v4
- name: Terraform init
id: init
run: terraform init
- name: Terraform validate
id: validate
run: terraform validate -no-color
- name: Terraform apply
run: terraform apply -auto-approve