-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (63 loc) · 1.96 KB
/
apply-terraform.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Nimbus
# Terraform
# Deploy Pipeline
#
name: "Deploy Terraform"
on:
workflow_dispatch:
inputs:
# setting: whether to deploy the warp vm
warp_vm_deploy:
type: boolean
description: "Deploy WARP VM?"
required: true
# warp vm machine type setting to control cpu, ram & cost of deployed vm
warp_vm_machine_type:
type: choice
description: "WARM VM Machine Type (CPU & RAM)"
required: true
options:
- "e2-micro - 0.25CPU, 1GB"
- "e2-small - 0.5CPU, 2GB"
- "e2-medium - 1CPU, 4GB"
- "e2-standard-2 - 2CPU, 8GB"
- "e2-standard-4 - 4CPU, 16GB"
- "e2-standard-8 - 8CPU, 32GB"
# config vm image used to start warp vm
warp_vm_image:
type: choice
description: "WARP VM Boot Image"
required: true
options:
- "warp-box"
- "warp-box-dev"
jobs:
apply-terraform:
name: "Apply Terraform deployment"
runs-on: ubuntu-20.04
defaults:
run:
working-directory: terraform
steps:
- uses: actions/checkout@v2
- name: "Setup Terraform CLI"
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.1.9
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: "Terraform Init"
run: terraform init
- name: "Terraform Apply"
if: ${{ github.ref == 'refs/heads/main' }}
env:
TF_VAR_has_warp_vm: "${{ github.event.inputs.warp_vm_deploy }}"
TF_VAR_warp_image: "${{ github.event.inputs.warp_vm_image }}"
# use LetsEncrypt's production server to issue trusted TLS certificates
TF_VAR_acme_server_url: "https://acme-v02.api.letsencrypt.org/directory"
run: >
terraform apply
-auto-approve=true
-var="warp_machine_type=$(
echo '${{ github.event.inputs.warp_vm_machine_type }}' | cut -d ' ' -f 1 -n
)"