Skip to content

Commit 0900105

Browse files
authored
Merge pull request #123 from trussworks/barry-update-things
chore: update all the things and tflint and trivy
2 parents d0b7fd1 + 13078be commit 0900105

14 files changed

+219
-74
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Validate - Terraform
2+
3+
on:
4+
workflow_call:
5+
pull_request:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
validate-tf:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
with:
15+
repository: ${{ github.event.pull_request.head.repo.full_name }}
16+
ref: ${{ github.event.pull_request.head.ref }}
17+
- name: Setup Terraform
18+
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
19+
- name: Install terraform-docs
20+
run: |
21+
curl -Lo ./terraform-docs.tar.gz https://github.com/terraform-docs/terraform-docs/releases/download/v0.19.0/terraform-docs-v0.19.0-linux-amd64.tar.gz
22+
tar -xzf terraform-docs.tar.gz
23+
chmod +x terraform-docs
24+
sudo mv terraform-docs /usr/local/bin/
25+
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
26+
with:
27+
python-version: "3.13"
28+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.gitignore

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
# .tfstate files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# Crash log files
9+
crash.log
10+
crash.*.log
11+
12+
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
13+
# password, private keys, and other secrets. These should not be part of version
14+
# control as they are data points which are potentially sensitive and subject
15+
# to change depending on the environment.
16+
*.tfvars
17+
*.tfvars.json
18+
19+
# Ignore override files as they are usually used to override resources locally and so
20+
# are not checked in
21+
override.tf
22+
override.tf.json
23+
*_override.tf
24+
*_override.tf.json
25+
*.envrc.local
26+
27+
# Ignore transient lock info files created by terraform apply
28+
.terraform.tfstate.lock.info
29+
30+
# Include override files you do wish to add to version control using negated pattern
31+
# !example_override.tf# Include override files you do wish to add to version control using negated pattern
32+
#
33+
# !example_override.tf
34+
35+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
36+
# example: *tfplan*
37+
tfplan
38+
*.plan
39+
*.out
40+
41+
#Editors
142
.DS_Store
2-
.terraform
3-
terraform.tfstate
4-
terraform.tfstate.backup
5-
terraform.tfstate.*.backup
6-
vendor
43+
*.swp
44+
*.sublime-*
45+
.*.stamp
46+
.idea
47+
.vscode
48+
tmp/
49+
50+
# Ignore CLI configuration files
51+
.terraformrc
52+
terraform.rc

.markdownlintrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"default": true,
3+
"first-header-h1": false,
4+
"first-line-h1": false,
5+
"line_length": false,
6+
"no-multiple-blanks": false,
7+
"no-inline-html": false,
8+
"no-alt-text": false
9+
}

.pre-commit-config.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-json
66
- id: check-merge-conflict
@@ -15,7 +15,7 @@ repos:
1515
- id: mixed-line-ending
1616

1717
- repo: https://github.com/executablebooks/mdformat
18-
rev: 0.7.16
18+
rev: 0.7.21
1919
hooks:
2020
- id: mdformat
2121
additional_dependencies:
@@ -25,19 +25,22 @@ repos:
2525
exclude: README.m(ark)?d(own)?
2626

2727
- repo: https://github.com/igorshubovych/markdownlint-cli
28-
rev: v0.33.0
28+
rev: v0.44.0
2929
hooks:
3030
- id: markdownlint
3131

32-
- repo: https://github.com/detailyang/pre-commit-shell
33-
rev: 1.0.5
32+
- repo: https://github.com/terraform-docs/terraform-docs
33+
rev: "v0.19.0"
3434
hooks:
35-
- id: shell-lint
35+
- id: terraform-docs-system
3636

3737
- repo: https://github.com/antonbabenko/pre-commit-terraform
38-
rev: v1.77.0
38+
rev: v1.97.0
3939
hooks:
40-
- id: terraform_docs
41-
args:
42-
- --args=--config=.terraform-docs.yml
40+
- id: terraform_validate
4341
- id: terraform_fmt
42+
- id: terraform_tflint
43+
- id: terraform_trivy
44+
args:
45+
- --args=--ignorefile=__GIT_WORKING_DIR__/.trivyignore.yaml
46+
- --args=--config=__GIT_WORKING_DIR__trivy.yaml

.terraform-docs.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
1+
version: ">= 0.19.0, < 1.0.0"
2+
13
settings:
24
html: false
35
anchor: false
6+
escape: false
7+
lockfile: false
8+
hide-empty: false # set to true when Terraform exists
49
formatter: "markdown table"
10+
11+
sort:
12+
enabled: true
13+
by: required
14+
15+
sections:
16+
show:
17+
- requirements
18+
- providers
19+
- modules
20+
- data-sources
21+
- resources
22+
- inputs
23+
- outputs
24+
25+
recursive:
26+
enabled: false
27+
include-main: false
28+
29+
output:
30+
file: README.md
31+
mode: inject
32+
template: |-
33+
<!-- BEGIN_TF_DOCS -->
34+
{{ .Content }}
35+
<!-- END_TF_DOCS -->

.terraform-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.10.4
1+
1.5.7

.terraform.lock.hcl

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.trivyignore.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# These are just examples to get you started.
2+
misconfigurations:
3+
- id: AVD-AWS-0342 # (MEDIUM): IAM policy allows 'iam:PassRole' action
4+
- id: AVD-AWS-0104 # (CRITICAL): Security group rule allows unrestricted egress to any IP address.
5+
- id: AVD-AWS-0176 # (MEDIUM): Instance does not have IAM Authentication enabled
6+
- id: AVD-AWS-0133 # (LOW): Instance does not have performance insights enabled.
7+
- id: AVD-AWS-0099 # (LOW): Security group explicitly uses the default description.

Makefile

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
.PHONY: ensure_pre_commit
2-
ensure_pre_commit: .git/hooks/pre-commit ## Ensure pre-commit is installed
3-
.git/hooks/pre-commit: /usr/local/bin/pre-commit
4-
pre-commit install
5-
pre-commit install-hooks
6-
7-
.PHONY: pre_commit_tests
8-
pre_commit_tests: ensure_pre_commit ## Run pre-commit tests
9-
pre-commit run --all-files
10-
11-
.PHONY: clean
12-
clean:
13-
rm -f .*.stamp
1+
.PHONY: target_lock
2+
target_lock:
3+
terraform providers lock \
4+
-platform=windows_amd64 \
5+
-platform=darwin_amd64 \
6+
-platform=darwin_arm64 \
7+
-platform=linux_amd64

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ module "example" {
2424
}
2525
```
2626

27-
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
27+
<!-- BEGIN_TF_DOCS -->
2828
## Requirements
2929

3030
| Name | Version |
3131
|------|---------|
32-
| terraform | >= 1.3.7 |
33-
| aws | ~> 4.52.0 |
32+
| terraform | 1.5.7 |
33+
| aws | ~> 5.0 |
3434

3535
## Providers
3636

@@ -51,14 +51,20 @@ No inputs.
5151
## Outputs
5252

5353
No outputs.
54-
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
54+
<!-- END_TF_DOCS -->
5555

5656
## Developer Setup
5757

58+
- [Pre-Commit](https://pre-commit.com/)
59+
- [TFenv](https://github.com/tfutils/tfenv)
60+
- [Terraform-Docs](https://terraform-docs.io/)
61+
- [TFLint](https://github.com/terraform-linters/tflint)
62+
- [Trivy](https://trivy.dev/)
63+
5864
Install dependencies (macOS)
5965

6066
```shell
61-
brew install pre-commit tfenv terraform-docs
67+
brew install pre-commit tfenv terraform-docs tflint trivy
6268
tfenv install
6369
pre-commit install --install-hooks
6470
```

0 commit comments

Comments
 (0)