-
Notifications
You must be signed in to change notification settings - Fork 7
41 lines (34 loc) · 1.38 KB
/
terraform_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
name: Terraform apply
on:
push:
# terraform が file(...) でファイルを参照することがあり、
# 参照されたファイルが変更された場合 re-apply する必要があるので、
# main へのコミット時は常に apply していい
branches:
- "main"
workflow_dispatch:
jobs:
tf_apply:
name: tf apply
runs-on: ubuntu-latest
concurrency: tf_apply_on_main
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TERRAFORM_CLOUD_API_TOKEN }}
terraform_version: 1.2.1
- name: Open tunnel to OnP k8s cluster
run: bash "./.github/workflows/scripts/open-tunnel-to-onp-k8s-and-export-tf-var-to-github-env.sh"
- name: Expose all Terraform variables to environment variables from secrets
run: bash "./.github/workflows/scripts/expose-all-tf-vars-to-github-env.sh"
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}
- run: terraform init
working-directory: "./terraform"
- name: Terraform apply
run: terraform apply -input=false -no-color -auto-approve -lock-timeout=10m
working-directory: "./terraform"
env:
TF_VAR_cloudflare_api_key: ${{ secrets.TF_VAR_CLOUDFLARE_API_KEY }}
TF_VAR_cloudflare_email: ${{ secrets.TF_VAR_CLOUDFLARE_EMAIL }}