Skip to content

Create HydroServer AWS Cloud Deployment #20

Create HydroServer AWS Cloud Deployment

Create HydroServer AWS Cloud Deployment #20

name: Create HydroServer AWS Cloud Deployment
on:
workflow_dispatch:
inputs:
environment:
description: 'Enter a deployment environment name.'
required: true
permissions:
id-token: write
contents: read
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"
steps:
- name: configureawscredentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/${{ vars.AWS_IAM_ROLE }}
role-session-name: create-hydroserver-resources
aws-region: ${{env.AWS_DEFAULT_REGION}}
- 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 -backend-config="key=state/aws_application_${{ github.event.inputs.environment }}"
- 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 }}"