-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (47 loc) · 1.92 KB
/
gcp-tf-validate.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
46
47
48
49
50
51
52
53
54
55
name: Terraform IaC template validation for GCP Infrastructure
on:
workflow_dispatch:
pull_request:
branches: [master]
jobs:
gcp_tf_validate:
runs-on: ubuntu-latest
environment: ${{ vars.ENVIRONMENT }}
name: Validate GCP Infrastructure
steps:
- name: Checking out the terraform code
uses: actions/checkout@v3
# - name: Create Terraform variables
# run: |
# cd root && touch prod.tfvars
# echo region=${{ vars.GCP_REGION }} >> prod.tfvars
# echo env=${{ vars.ENV }} >> prod.tfvars
# echo subnet_cidr=${{ vars.GCP_SUBNET_CIDR }} >> prod.tfvars
# echo project_name=${{ vars.GCP_PROJECT_NAME }} >> prod.tfvars
# echo project_id=${{ vars.GCP_PROJECT_ID }} >> prod.tfvars
# echo org_id=${{ vars.GCP_ORG_ID }} >> prod.tfvars
# echo billing_account_id=${{ secrets.GCP_ORG_ID }} >> prod.tfvars
# echo api_names=${{ vars.GCP_API_NAMES }} >> prod.tfvars
# echo vpc_name=${{vars.GCP_VPC_NAME}} >> prod.tfvars
# echo subnet_name=${{vars.GCP_SUBNET_NAME}} >> prod.tfvars
# echo vm_name=${{vars.GCP_VM_NAME}} >> prod.tfvars
# echo machine_type=${{vars.GCP_MACHINE_TYPE}} >> prod.tfvars
# echo zone=${{vars.GCP_ZONE}} >> prod.tfvars
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v4
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
# aws-region: ${{ vars.AWS_REGION }}
- name: Setup `Terraform`
uses: hashicorp/setup-terraform@v2
- name: Terraform fmt
id: fmt
run: terraform fmt -check
continue-on-error: true
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate