-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (69 loc) · 2.19 KB
/
deploy.yml
File metadata and controls
77 lines (69 loc) · 2.19 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Deploy Infrastructure
on:
workflow_dispatch:
inputs:
environment:
type: choice
description: Which environment to deploy
default: production
options:
- production
confirm_deploy:
type: boolean
description: Confirm Apply Changes?
default: false
aws_region:
type: choice
description: Region to deploy vpn server
default: eu-west-2
options:
- eu-west-2
- us-west-2
- ap-northeast-2
- ap-northeast-1
- eu-central-1
- eu-west-3
subdomain:
type: string
description: Subdomain Name
default: freevpn
env:
terraform_directory: example
terraform_version: 1.3.0
jobs:
deployment:
if: github.actor == 'zcemycl'
runs-on: ubuntu-latest
steps:
- name: Checkout the repository to the runner
uses: actions/checkout@v2
- name: Setup Terraform with specified version on the runner
uses: hashicorp/setup-terraform@v2
with:
terraform_version: $terraform_version
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID}}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ github.event.inputs.aws_region }}
- name: Initialise, check and plan
env:
TF_VAR_ADMIN_PWD: ${{ secrets.TF_VAR_OPENVPN_ADMIN_PWD }}
TF_VAR_AWS_REGION: ${{ github.event.inputs.aws_region }}
TF_VAR_SUBDOMAIN: ${{ github.event.inputs.subdomain }}
run: |
cp ${{ github.event.inputs.environment }}/* $terraform_directory
cd $terraform_directory
terraform init
terraform plan
continue-on-error: true
- name: Deploy
if: ${{ github.event.inputs.confirm_deploy == 'true' }}
env:
TF_VAR_ADMIN_PWD: ${{ secrets.TF_VAR_OPENVPN_ADMIN_PWD }}
TF_VAR_AWS_REGION: ${{ github.event.inputs.aws_region }}
TF_VAR_SUBDOMAIN: ${{ github.event.inputs.subdomain }}
run: |
cd $terraform_directory
terraform apply -auto-approve