Liveness readiness endpoint #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform Deployment | |
on: | |
workflow_dispatch: | |
push: null | |
pull_request: null | |
defaults: | |
run: | |
working-directory: ./terraform | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
checks: [tfsec, tflint] | |
include: | |
- checks: tfsec | |
commands: | | |
curl -s https://raw.githubusercontent.com/aquasecurity/tfsec/master/scripts/install_linux.sh | bash | |
tfsec . || true | |
- checks: tflint | |
commands: | | |
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash | |
tflint --init | |
tflint | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.9.8 | |
- name: Do checks | |
run: ${{ matrix.commands }} | |
deploy: | |
needs: | |
- checks | |
runs-on: ubuntu-latest | |
name: Deploy to ${{ matrix.name }} Environment | |
environment: | |
name: ${{ matrix.name }} | |
url: https://${{ vars.DOMAIN_NAME }} | |
strategy: | |
matrix: | |
name: | |
- dev | |
include: | |
- name: dev | |
description: "Deploy to Dev Environment" | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.9.8 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Set DB Password and Username as Environment Variables | |
run: | | |
echo "TF_VAR_name=${{ matrix.name }}-cluster" >> $GITHUB_ENV | |
echo "TF_VAR_db_username=${{ vars.DB_USERNAME }}" >> $GITHUB_ENV | |
echo "TF_VAR_db_password=${{ secrets.DB_PASSWORD }}" >> $GITHUB_ENV | |
echo "TF_VAR_oidc_kc_client_id=${{ vars.OIDC_KC_CLIENT_ID }}" >> $GITHUB_ENV | |
echo "TF_VAR_oidc_kc_client_secret=${{ secrets.OIDC_KC_CLIENT_SECRET }}" >> $GITHUB_ENV | |
echo "TF_VAR_oidc_kc_issuer_url=${{ vars.OIDC_KC_ISSUER_URL }}" >> $GITHUB_ENV | |
echo "TF_VAR_cert_arn=${{ vars.CERT_ARN }}" >> $GITHUB_ENV | |
echo "TF_VAR_region=${{ vars.AWS_REGION }}" >> $GITHUB_ENV | |
echo "TF_VAR_zone_name=${{ vars.DOMAIN_NAME }}" >> $GITHUB_ENV | |
- name: Terraform Init | |
run: terraform init -var-file=${{ matrix.name }}.tfvars | |
- name: Terraform Plan | |
run: terraform plan -var-file=${{ matrix.name }}.tfvars -out=plan.tfplan | |
- name: Terraform Apply | |
if: github.event_name == 'workflow_dispatch' | |
run: terraform apply -auto-approve plan.tfplan |