-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (46 loc) · 1.37 KB
/
Copy pathterraform_cloud.yml
File metadata and controls
57 lines (46 loc) · 1.37 KB
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
name: 'Terraform Cloud'
on:
push:
branches: [ main ]
#pull_request:
# branches: [ main ]
jobs:
Terraform:
name: 'Terraform Cloud'
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
# terraform_version: 0.13.0
cli_config_credentials_token: ${{ secrets.TERRAFORM_API_TOKEN }}
- name: Terraform Format
id: fmt
run: terraform fmt #-check
working-directory: './terraform-cloud'
- name: Terraform Init
id: init
run: terraform init
working-directory: './terraform-cloud'
- name: Terraform Validate
id: validate
run: terraform validate
working-directory: './terraform-cloud'
- name: Terraform Plan
id: plan
if: github.event_name == 'pull_request'
run: terraform plan
continue-on-error: true
working-directory: './terraform-cloud'
- name: 'Terraform Apply'
id: apply
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -auto-approve -lock=false -var=prefix=kdidi${{github.run_number}}
working-directory: './terraform-cloud'
- name: Terraform Destroy
id: destroy
run: terraform destroy
working-directory: './terraform-cloud'