Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Deploy Terraform

Deploy Terraform #4

name: "Deploy Terraform"
on: [pull_request, workflow_dispatch]
permissions:
id-token: write
contents: read
pull-requests: write
jobs:
deploy-infrastructure:
runs-on: ubuntu-latest
env:
TF_VAR_DB_USERNAME: ${{ secrets.DB_USERNAME }}
TF_VAR_DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
TF_VAR_AWS_REGION: ${{ secrets.AWS_REGION }}
defaults:
run:
shell: bash
working-directory: infrastructure
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
role-session-name: GITHUB_ACTION_RDS
aws-region: ${{ secrets.AWS_REGION }}
- name: Validate Identity with AWS
run: aws sts get-caller-identity
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Initialize Terraform
id: init
run: terraform init
- name: Generate infrastructure plan
id: plan
run: terraform plan -out=.tfplan
- name: Apply infrastructure plan
id: apply
run: terraform apply .tfplan
- name: log-endpoint
run: |
ls
tree
cat infrastructure/outputs.tf