Skip to content

Commit

Permalink
feat: Added github actions to create API Gateway and Cognito user poo…
Browse files Browse the repository at this point in the history
…l with App clients

Refer to task unity-sds/unity-cs#124
  • Loading branch information
ramesh-maddegoda committed Sep 30, 2022
1 parent 645b5da commit 7c49d7b
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deployment_api_gateway_and_cognito.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: deployment-api-gateway-and-cognito
on:
workflow_dispatch:
branches: [ main ]

permissions:
id-token: write # required to use OIDC authentication
contents: read # required to checkout the code from the repo

jobs:
build:
runs-on: ubuntu-latest
steps:
## Check Terraform formatting
- name: Terraform Format
working-directory: ./terraform-api-gateway-cognito
id: fmt
run: terraform fmt -check

## Init Terraform
- name: Terraform Init
working-directory: ./terraform-api-gateway-cognito
id: init
run: terraform init

## Validate Terraform
- name: Terraform Validate
working-directory: ./terraform-api-gateway-cognito
id: validate
run: terraform validate -no-color

## Plan Terraform
- name: Terraform Plan
working-directory: ./terraform-api-gateway-cognito
id: plan
run: terraform plan -no-color
continue-on-error: true

## Fail the job if terraform plan doesn't succeed
- name: Terraform Plan Status
working-directory: ./terraform-api-gateway-cognito
id: plan_status
if: steps.plan.outcome == 'failure'
run: exit 1

## Apply Terraform
- name: Terraform Apply
working-directory: ./terraform-api-gateway-cognito
id: apply
run: terraform apply -auto-approve
50 changes: 50 additions & 0 deletions .github/workflows/deployment_destroy_api_gateway_and_cognito.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: deployment-destroy-api-gateway-and-cognito
on:
workflow_dispatch:
branches: [ main ]

permissions:
id-token: write # required to use OIDC authentication
contents: read # required to checkout the code from the repo

jobs:
build:
runs-on: ubuntu-latest
steps:
## Check Terraform formatting
- name: Terraform Format
working-directory: ./terraform-api-gateway-cognito
id: fmt
run: terraform fmt -check

## Init Terraform
- name: Terraform Init
working-directory: ./terraform-api-gateway-cognito
id: init
run: terraform init

## Validate Terraform
- name: Terraform Validate
working-directory: ./terraform-api-gateway-cognito
id: validate
run: terraform validate -no-color

## Plan Terraform
- name: Terraform Plan
working-directory: ./terraform-api-gateway-cognito
id: plan
run: terraform plan -no-color
continue-on-error: true

## Fail the job if terraform plan doesn't succeed
- name: Terraform Plan Status
working-directory: ./terraform-api-gateway-cognito
id: plan_status
if: steps.plan.outcome == 'failure'
run: exit 1

## Destroy Terraform
- name: Terraform Destroy
working-directory: ./terraform-api-gateway-cognito
id: destroy
run: terraform destroy -auto-approve

0 comments on commit 7c49d7b

Please sign in to comment.