build(deps): bump github.com/bflad/tfproviderdocs from 0.8.0 to 0.11.1 in /tools #53
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: Examples Checks | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
paths: | |
- .github/workflows/examples.yml | |
- .go-version | |
- examples/** | |
- tools/go.mod | |
env: | |
AWS_DEFAULT_REGION: us-west-2 | |
jobs: | |
validate-terraform: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
terraform_version: ["0.12.29"] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} | |
# See also: https://github.com/actions/setup-go/pull/62 | |
- run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: go build | |
run: go build -o terraform-plugin-dir/terraform-provider-aws_v99.99.99_x5 . | |
- name: override plugin | |
run: mkdir -p ~/.terraform.d/plugins && cp terraform-plugin-dir/terraform-provider-aws_v99.99.99_x5 ~/.terraform.d/plugins | |
- uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: ${{ matrix.terraform_version }} | |
# Needed to use the output of `terraform validate -json` | |
terraform_wrapper: false | |
- name: install tflint | |
run: cd tools && go install github.com/terraform-linters/tflint | |
- 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 | |
# Terraform syntax checks | |
tflint \ | |
--enable-rule=terraform_deprecated_interpolation \ | |
--enable-rule=terraform_deprecated_index \ | |
--enable-rule=terraform_unused_declarations \ | |
--enable-rule=terraform_comment_syntax \ | |
--enable-rule=terraform_required_version | |
popd | |
done |