-
Notifications
You must be signed in to change notification settings - Fork 7
85 lines (71 loc) · 2.38 KB
/
fgt-tf-standalone-new-vcn.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: '[FGT] TF - Standalone - New-VCN'
env:
TFPath: FortiGate/Standalone/New-VCN/terraform/
ZIPfile: tf-fgt-standalone-newvcn.zip
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'FortiGate/Standalone/New-VCN/terraform/*.tf'
- 'FortiGate/Standalone/New-VCN/terraform/*.tpl'
- 'FortiGate/Standalone/New-VCN/terraform/*.hcl'
jobs:
OCI-FGT-TF-Standalone:
name: 'Terraform FortiGate Standalone'
runs-on: ubuntu-latest
env:
TF_VAR_tenancy_ocid: "${{ secrets.TENANCY_OCID }}"
TF_VAR_compartment_ocid: "${{ secrets.COMPARTMENT_OCID }}"
TF_VAR_user_ocid: "${{ secrets.USER_OCID }}"
TF_VAR_region: "${{ secrets.REGION }}"
TF_VAR_fingerprint: "${{ secrets.FINGERPRINT }}"
TF_VAR_private_key_path: ~/.oci/oci_api_key.pem
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Setup Terraform"
uses: hashicorp/setup-terraform@v3
- name: Configure OCI credentials
run: |
mkdir -p ~/.oci
echo "${{ secrets.OCI_PEM_KEY }}" > ~/.oci/oci_api_key.pem
chmod 600 ~/.oci/oci_api_key.pem
- name: "Terraform Init"
id: init
run: terraform init
working-directory: ${{ env.TFPath }}
- name: "Terraform Validation"
id: validate
run: terraform validate
working-directory: ${{ env.TFPath }}
- name: "Terraform Format"
id: format
run: terraform fmt -check -diff
working-directory: ${{ env.TFPath }}
- name: "Terraform Plan"
id: plan
run: terraform plan -out plan.tfplan
working-directory: ${{ env.TFPath }}
- name: "Terraform Show"
id: show
run: terraform show -json plan.tfplan
working-directory: ${{ env.TFPath }}
- name: "Save Plan JSON"
run: echo '${{ steps.show.outputs.stdout }}' > plan.json # Do not change
- name: Package and convert templates
uses: azure/powershell@v1
with:
inlineScript: |
Compress-Archive -Path "./FortiGate/Standalone/New-VCN/*" -DestinationPath "./${{ env.ZIPfile }}"
azPSVersion: "latest"
- name: upload-templates-zip
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
file: ./${{ env.ZIPfile }}
asset_name: ${{ env.ZIPfile }}
tag: fgtstandalone
overwrite: true
body: "OCI FortiGate Standalone"