fix: replace node12 with node20 runtimes in examples #57
Workflow file for this run
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: | |
pull_request: | |
branches: [main] | |
jobs: | |
env: | |
name: Set Env Vars | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Environment Variables | |
if: github.base_ref == 'main' | |
run: | | |
matrix='{ | |
"env":[ | |
{ | |
"tf_version":"0.13.2", | |
"tf_working_dir":"./examples/ci-0_13", | |
"aws_account":"977306314792", | |
"aws_gha_role":"terraform-lambda-api-dev-gha" | |
}, | |
{ | |
"tf_version":"0.14.8", | |
"tf_working_dir":"./examples/ci-0_14", | |
"aws_account":"977306314792", | |
"aws_gha_role":"terraform-lambda-api-dev-gha" | |
}, | |
{ | |
"tf_version":"1.0.0", | |
"tf_working_dir":"./examples/ci-1", | |
"aws_account":"977306314792", | |
"aws_gha_role":"terraform-lambda-api-dev-gha" | |
} | |
] | |
}' | |
echo matrix=`echo $matrix | jq -c .` >> $GITHUB_ENV | |
outputs: | |
matrix: ${{ env.matrix }} | |
format: | |
name: Terraform Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Terraform Setup | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.0.0 | |
- name: Terraform Format | |
working-directory: "./" | |
run: terraform fmt -check -recursive | |
plan: | |
name: Terraform Plan | |
runs-on: ubuntu-latest | |
needs: env | |
strategy: | |
matrix: ${{ fromJson(needs.env.outputs.matrix) }} | |
fail-fast: false | |
permissions: | |
contents: read | |
actions: read | |
pull-requests: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: "arn:aws:iam::${{ matrix.env.aws_account }}:role/${{ matrix.env.aws_gha_role }}" | |
role-session-name: ${{ github.sha }} | |
aws-region: us-west-2 | |
- name: Terraform Setup | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ matrix.env.tf_version }} | |
- name: Terraform Init | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
run: terraform init | |
- name: Terraform Plan | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
run: terraform plan -input=false -out=plan.tfplan | |
- name: Comment Terraform Plan | |
uses: byu-oit/github-action-tf-plan-comment@v1 | |
with: | |
comment-title: Plan for Terraform v-${{ matrix.env.tf_version }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
terraform-plan-file: plan.tfplan | |
- name: Analyze Terraform Plan | |
uses: byu-oit/github-action-tf-plan-analyzer@v2 | |
with: | |
divvycloud-username: ${{ secrets.DIVVYCLOUD_USERNAME }} | |
divvycloud-password: ${{ secrets.DIVVYCLOUD_PASSWORD }} | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
terraform-plan-file: plan.tfplan |