Skip to content

Commit 395011d

Browse files
committed
chore: bringing inline with the changes
1 parent a4e0e7f commit 395011d

11 files changed

+120
-128
lines changed

.commitlintrc.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
rules:
3+
body-leading-blank: [1, always]
4+
body-max-line-length: [2, always, 100]
5+
footer-leading-blank: [1, always]
6+
footer-max-line-length: [2, always, 100]
7+
header-max-length: [2, always, 100]
8+
subject-case:
9+
- 2
10+
- never
11+
- [sentence-case, start-case, pascal-case, upper-case]
12+
subject-empty: [2, never]
13+
subject-full-stop: [2, never, "."]
14+
type-case: [2, always, lower-case]
15+
type-empty: [2, never]
16+
type-enum:
17+
- 2
18+
- always
19+
- [build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test]

.gitignore

+20-7
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
*.tfstate
66
*.tfstate.*
77

8+
# terraform lock file
9+
.terraform.lock.hcl
10+
811
# Crash log files
912
crash.log
1013
crash.*.log
1114

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-
1915
# Ignore override files as they are usually used to override resources locally and so
2016
# are not checked in
2117
override.tf
@@ -32,3 +28,20 @@ override.tf.json
3228
# Ignore CLI configuration files
3329
.terraformrc
3430
terraform.rc
31+
32+
# Other
33+
.DS_Store
34+
todo.md
35+
36+
# Ignore vim swap files
37+
*.swp
38+
*.swo
39+
40+
# Ignore meld diff files
41+
*.orig
42+
*.backup
43+
*.rej
44+
45+
# Ignore lambda zip files and build directories
46+
*.zip
47+
builds/

.terraform-docs.yaml .terraform-docs.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
formatter: markdown
21
#header-from: .header.md
32
settings:
43
anchor: true
@@ -12,10 +11,18 @@ settings:
1211
type: true
1312
lockfile: false
1413

15-
sort:
16-
enabled: true
17-
by: required
14+
formatter: "markdown table"
1815

1916
output:
2017
file: README.md
2118
mode: inject
19+
20+
sections:
21+
show:
22+
- providers
23+
- inputs
24+
- outputs
25+
26+
sort:
27+
enabled: true
28+
by: required

.tflint.hcl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
plugin "aws" {
22
enabled = true
3-
version = "0.32.0"
3+
version = "0.36.0"
44
source = "github.com/terraform-linters/tflint-ruleset-aws"
55
}
66

77
plugin "terraform" {
88
enabled = true
9-
version = "0.7.0"
9+
version = "0.10.0"
1010
source = "github.com/terraform-linters/tflint-ruleset-terraform"
1111
}
1212

.trivyignore

Whitespace-only changes.

Makefile

+51-52
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@ examples:
3636

3737
documentation:
3838
@echo "--> Generating documentation"
39-
@terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject .
39+
@terraform-docs .
4040
$(MAKE) documentation-modules
4141
$(MAKE) documentation-examples
4242

4343
documentation-modules:
4444
@echo "--> Generating documentation for modules"
45-
@if [ -d modules ]; then \
46-
find modules -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
47-
fi
45+
@find . -type d -regex '.*/modules/[a-za-z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
46+
echo "--> Generating documentation for module: $$dir"; \
47+
terraform-docs $$dir; \
48+
done;
4849

4950
documentation-examples:
50-
@echo "--> Generating documentation examples"
51-
@if [ -d examples ]; then \
52-
find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
53-
fi
51+
@echo "--> Generating documentation for examples"
52+
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null| while read -r dir; do \
53+
echo "--> Generating documentation for example: $$dir"; \
54+
terraform-docs $$dir; \
55+
done;
5456

5557
upgrade-terraform-providers:
5658
@printf "%s Upgrading Terraform providers for %-24s" "-->" "."
@@ -59,7 +61,7 @@ upgrade-terraform-providers:
5961

6062
upgrade-terraform-example-providers:
6163
@if [ -d examples ]; then \
62-
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
64+
find examples -type d -mindepth 1 -maxdepth 1 2>/dev/null | while read -r dir; do \
6365
printf "%s Upgrading Terraform providers for %-24s" "-->" "$$dir"; \
6466
terraform -chdir=$$dir init -upgrade >/dev/null && echo "[OK]" || echo "[FAILED]"; \
6567
done; \
@@ -68,30 +70,32 @@ upgrade-terraform-example-providers:
6870
init:
6971
@echo "--> Running terraform init"
7072
@terraform init -backend=false
73+
@find . -type f -name "*.tf" -not -path '*.terraform*' -exec dirname {} \; | sort -u | while read -r dir; do \
74+
echo "--> Running terraform init in $$dir"; \
75+
terraform -chdir=$$dir init -backend=false; \
76+
done;
7177

72-
security:
78+
security: init
7379
@echo "--> Running Security checks"
7480
@trivy config .
7581
$(MAKE) security-modules
7682
$(MAKE) security-examples
7783

7884
security-modules:
7985
@echo "--> Running Security checks on modules"
80-
@if [ -d modules ]; then \
81-
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
82-
echo "--> Validating $$dir"; \
83-
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
84-
done; \
85-
fi
86+
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
87+
echo "--> Validating $$dir"; \
88+
terraform init -backend=false; \
89+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
90+
done;
8691

8792
security-examples:
8893
@echo "--> Running Security checks on examples"
89-
@if [ -d examples ]; then \
90-
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
91-
echo "--> Validating $$dir"; \
92-
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
93-
done; \
94-
fi
94+
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
95+
echo "--> Validating $$dir"; \
96+
terraform init -backend=false; \
97+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
98+
done;
9599

96100
tests:
97101
@echo "--> Running Terraform Tests"
@@ -103,29 +107,28 @@ validate:
103107
@terraform validate
104108
$(MAKE) validate-modules
105109
$(MAKE) validate-examples
110+
$(MAKE) validate-commits
106111

107112
validate-modules:
108113
@echo "--> Running terraform validate on modules"
109-
@if [ -d modules ]; then \
110-
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
111-
echo "--> Validating $$dir"; \
112-
terraform -chdir=$$dir init -backend=false; \
113-
terraform -chdir=$$dir validate; \
114-
done; \
115-
fi
114+
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
115+
echo "--> Validating Module $$dir"; \
116+
terraform -chdir=$$dir init -backend=false; \
117+
terraform -chdir=$$dir validate; \
118+
done;
116119

117120
validate-examples:
118121
@echo "--> Running terraform validate on examples"
119-
@if [ -d examples ]; then \
120-
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
121-
echo "--> Validating $$dir"; \
122-
terraform -chdir=$$dir init -backend=false; \
123-
terraform -chdir=$$dir validate; \
124-
done; \
125-
fi
122+
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
123+
echo "--> Validating $$dir"; \
124+
terraform -chdir=$$dir init -backend=false; \
125+
terraform -chdir=$$dir validate; \
126+
done;
126127

127128
validate-commits:
128-
@echo "--> Running commitlint against the "
129+
@echo "--> Running commitlint against the main branch"
130+
@command -v commitlint >/dev/null 2>&1 || { echo "commitlint is not installed. Please install it by running 'npm install -g commitlint'"; exit 1; }
131+
@git log --pretty=format:"%s" origin/main..HEAD | commitlint --from=origin/main
129132

130133
lint:
131134
@echo "--> Running tflint"
@@ -136,31 +139,27 @@ lint:
136139

137140
lint-modules:
138141
@echo "--> Running tflint on modules"
139-
@if [ -d modules ]; then \
140-
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
141-
echo "--> Linting $$dir"; \
142-
tflint --chdir=$$dir --init; \
143-
tflint --chdir=$$dir -f compact; \
144-
done; \
145-
fi
142+
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
143+
echo "--> Linting $$dir"; \
144+
tflint --chdir=$$dir --init; \
145+
tflint --chdir=$$dir -f compact; \
146+
done;
146147

147148
lint-examples:
148149
@echo "--> Running tflint on examples"
149-
@if [ -d examples ]; then \
150-
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
151-
echo "--> Linting $$dir"; \
152-
tflint --chdir=$$dir --init; \
153-
tflint --chdir=$$dir -f compact; \
154-
done; \
155-
fi
150+
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
151+
echo "--> Linting $$dir"; \
152+
tflint --chdir=$$dir --init; \
153+
tflint --chdir=$$dir -f compact; \
154+
done;
156155

157156
format:
158157
@echo "--> Running terraform fmt"
159158
@terraform fmt -recursive -write=true
160159

161160
clean:
162161
@echo "--> Cleaning up"
163-
@find . -type d -name ".terraform" | while read -r dir; do \
162+
@find . -type d -name ".terraform" 2>/dev/null | while read -r dir; do \
164163
echo "--> Removing $$dir"; \
165164
rm -rf $$dir; \
166165
done

README.md

-24
Original file line numberDiff line numberDiff line change
@@ -69,36 +69,12 @@ module "permissionset" {
6969
```
7070

7171
<!-- BEGIN_TF_DOCS -->
72-
## Requirements
73-
74-
| Name | Version |
75-
|------|---------|
76-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
77-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
78-
7972
## Providers
8073

8174
| Name | Version |
8275
|------|---------|
8376
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.0 |
8477

85-
## Modules
86-
87-
| Name | Source | Version |
88-
|------|--------|---------|
89-
| <a name="module_assignments"></a> [assignments](#module\_assignments) | ./modules/assignment | n/a |
90-
91-
## Resources
92-
93-
| Name | Type |
94-
|------|------|
95-
| [aws_ssoadmin_customer_managed_policy_attachment.customer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_customer_managed_policy_attachment) | resource |
96-
| [aws_ssoadmin_managed_policy_attachment.managed](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_managed_policy_attachment) | resource |
97-
| [aws_ssoadmin_permission_set.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_permission_set) | resource |
98-
| [aws_ssoadmin_permission_set_inline_policy.customer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_permission_set_inline_policy) | resource |
99-
| [aws_ssoadmin_permissions_boundary_attachment.customer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_permissions_boundary_attachment) | resource |
100-
| [aws_ssoadmin_permissions_boundary_attachment.managed](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_permissions_boundary_attachment) | resource |
101-
10278
## Inputs
10379

10480
| Name | Description | Type | Default | Required |

examples/basics/README.md

-22
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
11
<!-- BEGIN_TF_DOCS -->
2-
## Requirements
3-
4-
| Name | Version |
5-
|------|---------|
6-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.7 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0.0 |
8-
92
## Providers
103

114
| Name | Version |
125
|------|---------|
136
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0.0 |
147

15-
## Modules
16-
17-
| Name | Source | Version |
18-
|------|--------|---------|
19-
| <a name="module_billing_viewer"></a> [billing\_viewer](#module\_billing\_viewer) | ../.. | n/a |
20-
21-
## Resources
22-
23-
| Name | Type |
24-
|------|------|
25-
| [aws_identitystore_group.groups](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/identitystore_group) | data source |
26-
| [aws_organizations_organization.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organization) | data source |
27-
| [aws_organizations_organizational_unit_descendant_accounts.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organizational_unit_descendant_accounts) | data source |
28-
| [aws_ssoadmin_instances.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssoadmin_instances) | data source |
29-
308
## Inputs
319

3210
| Name | Description | Type | Default | Required |

examples/basics/values/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Providers
3+
4+
No providers.
5+
6+
## Inputs
7+
8+
No inputs.
9+
10+
## Outputs
11+
12+
No outputs.
13+
<!-- END_TF_DOCS -->
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
sso_groups = [
3+
"Cloud Billing"
4+
]

modules/assignment/README.md

-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
11
<!-- BEGIN_TF_DOCS -->
2-
## Requirements
3-
4-
| Name | Version |
5-
|------|---------|
6-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
8-
92
## Providers
103

114
| Name | Version |
125
|------|---------|
136
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 5.0 |
147

15-
## Modules
16-
17-
No modules.
18-
19-
## Resources
20-
21-
| Name | Type |
22-
|------|------|
23-
| [aws_ssoadmin_account_assignment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssoadmin_account_assignment) | resource |
24-
258
## Inputs
269

2710
| Name | Description | Type | Default | Required |

0 commit comments

Comments
 (0)