-
Notifications
You must be signed in to change notification settings - Fork 7
44 lines (37 loc) · 1.21 KB
/
aws_create_deployment.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
name: Create HydroServer AWS Cloud Deployment
on:
workflow_dispatch:
inputs:
environment:
description: 'Enter a deployment environment name.'
required: true
jobs:
setup-deployment:
runs-on: ubuntu-20.04
environment: ${{ github.event.inputs.environment }}
defaults:
run:
working-directory: ./terraform/aws
env:
AWS_DEFAULT_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: main
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Plan
id: plan
run: terraform plan -no-color -var instance="${{ github.event.inputs.environment }}"
continue-on-error: true
- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Apply
run: terraform apply -auto-approve -var instance="${{ github.event.inputs.environment }}"