Skip to content

Bump actions/checkout from 3 to 4 #19

Bump actions/checkout from 3 to 4

Bump actions/checkout from 3 to 4 #19

Workflow file for this run

name: 'Terraform-Workflow'
on: [push, workflow_dispatch]
permissions:
id-token: write # required to use OIDC authentication
contents: read # required to checkout the code from the repo
jobs:
deploy:
name: 'Terraform'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./terraform
environment: NGAP DEV # default NGAP env, can be changed as needed
env:
TF_LOG: INFO
steps:
- name: Checkout
uses: actions/checkout@v4
# AWS Authentication. Please uncomment this step in your repo to authenticate to AWS.
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v2
# with:
# aws-region: "${{ secrets.AWS_REGION }}"
# role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
# role-session-name: PDS_GitHub_OIDC_TERRAFORM
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- name: Terraform Init
id: init
env:
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME}}
AWS_BUCKET_KEY_NAME: ${{ secrets.AWS_BUCKET_KEY_NAME}}
run: terraform init -backend-config="bucket=${AWS_BUCKET_NAME}" -backend-config="key=${AWS_BUCKET_KEY_NAME}"
- name: Terraform Format & Validate
id: fmt_validate
run: |
terraform fmt
terraform validate -no-color
# Please uncomment the plan and apply steps below in your terraform worfklow to deploy your infrastructure to AWS.
# - name: Terraform Plan
# id: plan
# run: terraform plan -no-color
# continue-on-error: true
# - name: Terraform Plan Status
# id : plan_status
# if: steps.plan.outcome == 'failure'
# run: exit 1
# - name: Terraform Apply
# if: github.ref == 'refs/heads/main' && github.event_name == 'push' # both conditions have to be met
# run: terraform apply -auto-approve