State new AWS provider requirement (v5.26) in README #151
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] | |
env: | |
tf_version: "1.3.4" # Must be within range specified in main.tf | |
node_version: "20.x" | |
TF_IN_AUTOMATION: true | |
jobs: | |
env: | |
name: Set Env Vars | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up DEV Environment Variables | |
if: github.base_ref == 'main' | |
run: | | |
matrix='{ | |
"env":[ | |
{ | |
"tf_working_dir":"./examples/simple", | |
"aws_account":"977306314792", | |
"aws_gha_role":"postman-test-lambda-dev-gha", | |
"tf_plan_extra_args":"" | |
}, | |
{ | |
"tf_working_dir":"./examples/advanced", | |
"aws_account":"977306314792", | |
"aws_gha_role":"postman-test-lambda-dev-gha", | |
"tf_plan_extra_args":"-var 'postman_api_key=fake_api_key'" | |
} | |
] | |
}' | |
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: ${{ env.tf_version }} | |
- 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) }} | |
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: ${{ 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 ${{ matrix.env.tf_plan_extra_args }} | |
- name: Comment Terraform Plan | |
uses: byu-oit/github-action-tf-plan-comment@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ${{ matrix.env.tf_working_dir }} | |
terraform-plan-file: plan | |
comment-title: Terraform Plan for ${{ matrix.env.tf_working_dir }} | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node_version }} | |
- name: npm install | |
working-directory: lambda | |
run: npm install --production | |
audit: | |
name: Audit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node_version }} | |
- name: npm audit | |
working-directory: lambda | |
run: npm audit --audit-level=critical | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node_version }} | |
- name: npm install | |
working-directory: lambda | |
run: npm install | |
- name: npm lint | |
working-directory: lambda | |
run: npm run lint |