-
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.15 KB
/
terraform-apply.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
---
name: Launch Server
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
size:
description: droplet size
type: choice
default: s-1vcpu-1gb-amd
options:
- s-1vcpu-1gb-amd
- s-1vcpu-2gb-amd
- s-2vcpu-2gb-amd
- s-2vcpu-4gb-amd
- s-2vcpu-8gb-amd
- s-4vcpu-8gb
defaults:
run:
working-directory: ./terraform
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Terraform Init
run: terraform init
- name: Terraform Validate
run: terraform validate
- name: Terraform Apply
run: |
terraform apply -auto-approve
echo "DROPLET_IPV4_ADDRESS=$(terraform output -raw droplet_ipv4_address)" >> $GITHUB_ENV
env:
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
TF_VAR_droplet_size: ${{ inputs.size }}
- name: ${{ env.DROPLET_IPV4_ADDRESS }}
run: echo $DROPLET_IPV4_ADDRESS