Skip to content

Commit

Permalink
get ready for using tfmod-scaffold as pr check for avm
Browse files Browse the repository at this point in the history
  • Loading branch information
lonegunmanb committed Dec 14, 2023
1 parent ae8ed53 commit 8141d06
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 1,239 deletions.
41 changes: 2 additions & 39 deletions .github/actions/docs-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,12 @@ description: Checks that documentation has been updated on PR
runs:
using: composite
steps:
- name: setup go
uses: actions/setup-go@v4
with:
go-version: "1.21.x"
# cache-dependency-path: tests/go.sum

- name: setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- name: install tools
shell: bash
run: |
go install github.com/katbyte/terrafmt@latest
go install github.com/terraform-docs/terraform-docs@latest
- name: fmt check
shell: bash
run: |
echo "==> Fixing Terraform code with terraform fmt..."
terraform fmt -recursive
echo "==> Fixing embedded Terraform with terrafmt..."
find . | egrep ".md|.tf" | grep -v README.md | sort | while read f; do terrafmt fmt $f; done
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make fmtcheck
- name: docs check
shell: bash
run: |
echo "==> Generating module documentation..."
terraform-docs -c .terraform-docs.yml .
echo "==> Generating examples documentation..."
cd examples && for d in $(ls -d */); do terraform-docs $d; done
- name: check for changes
shell: bash
run: |
echo "==> Testing for changes to tracked files"
CHANGES=$(git status -suno)
if [ "$CHANGES" ]; then
echo "Repository formatting or documentation is not correct."
echo
git diff
echo
echo "Run 'make fmt && make docs' locally and commit the changes to fix."
exit 1
fi
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make docscheck
20 changes: 11 additions & 9 deletions .github/actions/linting/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,28 @@ inputs:
runs:
using: composite
steps:
- name: grept
run: exit 0
shell: bash

- name: terraform fmt check
run: exit 0
shell: bash
run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make tffmtcheck
- name: terraform validate
run: exit 0
shell: bash
run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make tfvalidatecheck
- name: terraform docs check
run: exit 0
- name: terrafmt check
shell: bash
run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make terrafmtcheck
- name: tflint
run: exit 0
shell: bash
run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform make tflint
- name: tfsec
run: exit 0
shell: bash
run: |
echo "Bypass tfsec for now"
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
outputs:
examples: ${{ steps.getexamples.outputs.examples }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: get examples
id: getexamples
uses: Azure/terraform-azurerm-avm-template/.github/actions/e2e-getexamples@main
Expand All @@ -38,7 +38,7 @@ jobs:
example: ${{ fromJson(needs.getexamples.outputs.examples) }}
max-parallel: 5
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- uses: Azure/login@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v4
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- name: check docs
uses: Azure/terraform-azurerm-avm-template/.github/actions/docs-check@main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/version-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: github.event.repository.name != 'terraform-azurerm-avm-template'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
- name: Check version
uses: Azure/terraform-azurerm-avm-template/.github/actions/version-check@main
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc
avmmakefile
README-generated.md
avm.tflint.hcl
avm.tflint_example.hcl
Loading

0 comments on commit 8141d06

Please sign in to comment.