Update pipeline.yml #98
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: Terraform | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, reopened, synchronize] | |
branches: [main] | |
release: | |
types: [published] | |
env: | |
DEFAULT_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: localstack | |
AWS_SECRET_ACCESS_KEY: localstack | |
jobs: | |
check-format: | |
runs-on: ubuntu-latest | |
container: hashicorp/terraform | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Terraform Format Check | |
run: terraform fmt -check -recursive -diff | |
validations: | |
runs-on: ubuntu-latest | |
container: hashicorp/terraform | |
strategy: | |
matrix: { | |
dir: [ | |
'examples/basic', | |
'examples/log-configuration-cw', | |
'examples/log-configuration-s3', | |
'examples/setting-container-insights', | |
'examples/service-connect-defaults' | |
] | |
} | |
services: | |
localstack: | |
image: localstack/localstack | |
env: | |
SERVICES: apigateway,cloudformation,cloudwatch,dynamodb,es,firehose,iam,kinesis,lambda,route53,redshift,s3,secretsmanager,ses,sns,sqs,ssm,stepfunctions,sts | |
ports: | |
- 4566:4566 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Terraform Init | |
run: terraform init -upgrade | |
working-directory: ${{ matrix.dir }} | |
- name: Terraform Validate | |
run: terraform validate | |
working-directory: ${{ matrix.dir }} | |
- name: Terraform Plan (Mock) | |
run: terraform plan | |
working-directory: ${{ matrix.dir }} | |
- name: Setup Infracost | |
uses: infracost/actions/setup@v2 | |
with: | |
api-key: ${{ secrets.INFRACOST_API_KEY }} | |
- name: Generate Infracost cost estimate | |
run: infracost breakdown --path ${{ matrix.dir }} |