Skip to content

Terraform (Plan||Apply) #33

Terraform (Plan||Apply)

Terraform (Plan||Apply) #33

Workflow file for this run

name: Deploy to ECS
on:
workflow_dispatch:
inputs:
environment:
description: 'The environment to deploy to'
required: true
type: choice
options:
- ""
- prod
concurrency:
group: ${{ github.event.inputs.environment }}-deploy
cancel-in-progress: false
permissions:
id-token: write
contents: read
env:
aws_region: us-east-1
environment: ${{ github.event.inputs.environment }}
owner: "skylight"
project: "dibbs-ce"
jobs:
terraform:
name: Run Terraform
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./terraform/implementation/ecs
steps:
- name: Check Out Changes
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-session-name: githubDeploymentWorkflow
aws-region: ${{ env.aws_region }}
- name: Terraform
env:
ENVIRONMENT: ${{ env.environment }}
BUCKET: ${{ secrets.TFSTATE_BUCKET }}
DYNAMODB_TABLE: ${{ secrets.TFSTATE_DYNAMODB_TABLE }}
REGION: ${{ env.aws_region }}
OWNER: ${{ env.owner }}
PROJECT: ${{ env.project }}
shell: bash
run: |
echo "ENVIRONMENT=$ENVIRONMENT" >> .env
echo "BUCKET=$BUCKET" >> .env
echo "DYNAMODB_TABLE=$DYNAMODB_TABLE" >> .env
echo "REGION=$REGION" >> .env
echo "owner = \"$OWNER\"" >> $ENVIRONMENT.tfvars
echo "project = \"$PROJECT\"" >> $ENVIRONMENT.tfvars
echo "region = \"$REGION\"" >> $ENVIRONMENT.tfvars
./ecs.sh -e $ENVIRONMENT --ci