chore: setting s3 backend for terraform state #10
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: CI | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
run-terraform: | |
name: 'Run Terraform' | |
runs-on: ubuntu-latest | |
env: | |
TF_VAR_aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }} | |
TF_VAR_aws_region: ${{ secrets.AWS_REGION }} | |
TF_VAR_thumbprint: ${{ secrets.THUMBPRINT }} | |
TF_VAR_gh_app_repo: ${{ secrets.GH_APP_REPO }} | |
TF_VAR_gh_iac_repo: ${{ secrets.GH_IAC_REPO }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: 'arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/tf_role' | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: ${{ vars.TF_VERSION }} | |
- name: Run Terraform Init | |
run: terraform init | |
- name: Run Terraform Format | |
run: terraform fmt -check | |
- name: Run Terraform Plan | |
run: terraform plan | |
- name: Run Terraform Apply | |
run: terraform apply -auto-approve |