-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (35 loc) · 1.27 KB
/
terrafrom_ncp_iac.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
name: NCP IaC
on:
push:
branches:
- infra/main
workflow_dispatch:
jobs:
terraform:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
working-directory: ./infra/terraform
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Terraform Setup
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.8.2
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Init
working-directory: ${{ env.working-directory }}
run: terraform init
- name: Terraform Format
working-directory: ${{ env.working-directory }}
run: terraform fmt -check
- name: Terraform Plan
working-directory: ${{ env.working-directory }}
run: terraform plan -var=ncp_access_key=${{ secrets.NCP_ACCESS_KEY_ID }} -var=ncp_secret_key=${{ secrets.NCP_SECRET_ACCESS_KEY }} -input=false
- name: Terraform Apply
working-directory: ${{ env.working-directory }}
if: github.ref == 'refs/heads/infra/main' && github.event_name == 'push'
run: terraform apply -auto-approve -var=ncp_access_key=${{ secrets.NCP_ACCESS_KEY_ID }} -var=ncp_secret_key=${{ secrets.NCP_SECRET_ACCESS_KEY }} -input=false