Skip to content

Provision aws resources #1

Provision aws resources

Provision aws resources #1

Workflow file for this run

name: Infrastructure CI and CD
on:
push:
branches:
- main
paths:
- .github/**
- infrastructure/**
pull_request:
paths:
- .github/**
- infrastructure/**
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_VAR_PROJECT_NAME: tarhche
TF_VAR_INSTANCE_NAME: backend
TF_VAR_SSH_PUBLIC_KEY: $(shell cat ssh-public-key.pub)
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Format
id: fmt
run: terraform fmt -check
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
run: terraform plan -no-color -input=false
continue-on-error: true
cd:
runs-on: ubuntu-latest
# This job will be invoked only on default branch
if: ${{ always() && format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }}
needs:
- ci
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Apply
run: terraform apply -auto-approve -input=false
continue-on-error: true