Skip to content

Bump the terraform-devex group across 1 directory with 3 updates (#39… #16363

Bump the terraform-devex group across 1 directory with 3 updates (#39…

Bump the terraform-devex group across 1 directory with 3 updates (#39… #16363

Workflow file for this run

name: Examples Checks
on:
push:
branches:
- main
pull_request:
paths:
- .github/workflows/examples.yml
- .ci/.tflint.hcl
- .ci/tools/go.mod
- examples/**
- go.mod
## NOTE: !!!
## When changing these workflows, ensure that the following is updated:
## - Documentation: docs/continuous-integration.md
## - Documentation: docs/makefile-cheat-sheet.md
## - Makefile: ./GNUmakefile
env:
AWS_DEFAULT_REGION: us-west-2
jobs:
tflint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: go.mod
- name: install tflint
run: cd .ci/tools && go install github.com/terraform-linters/tflint
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ runner.os }}-tflint-${{ hashFiles('.ci/.tflint.hcl') }}
- run: tflint --config .ci/.tflint.hcl --init
- name: tflint
run: |
TFLINT_CONFIG="$(pwd -P)/.ci/.tflint.hcl"
tflint --config="${TFLINT_CONFIG}" --chdir=./examples --recursive \
--disable-rule=terraform_typed_variables
validate-terraform:
runs-on: custom-linux-large
strategy:
fail-fast: false
matrix:
terraform_version: ["0.12.31", "1.0.6"]
env:
TF_IN_AUTOMATION: "1"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: go.mod
- name: go build
run: go build -o terraform-plugin-dir/terraform-provider-aws_v99.99.99_x5 .
- name: override plugin
run: |
# For Terraform v0.12
mkdir -p ~/.terraform.d/plugins
cp terraform-plugin-dir/terraform-provider-aws_v99.99.99_x5 ~/.terraform.d/plugins
# For newer versions
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/99.99.99/"$(go env GOOS)"_"$(go env GOARCH)"/
cp terraform-plugin-dir/terraform-provider-aws_v99.99.99_x5 ~/.terraform.d/plugins/registry.terraform.io/hashicorp/aws/99.99.99/"$(go env GOOS)"_"$(go env GOARCH)"/
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd
with:
terraform_version: ${{ matrix.terraform_version }}
# Needed to use the output of `terraform validate -json`
terraform_wrapper: false
- name: terraform
run: |
for DIR in $(find ./examples -type f -name '*.tf' -exec dirname {} \; | sort -u); do
pushd "$DIR"
if [ -f terraform.template.tfvars ]; then
cp terraform.template.tfvars terraform.tfvars
fi
echo; echo -e "\e[1;35m===> Initializing Example: $DIR <===\e[0m"; echo
terraform init
echo; echo -e "\e[1;35m===> Format Checking Example: $DIR <===\e[0m"; echo
terraform fmt -check
echo; echo -e "\e[1;35m===> Validating Example: $DIR <===\e[0m"; echo
# Catch errors
terraform validate
popd
done