Skip to content

Commit c0e1797

Browse files
authored
chore(deps): updating inline with the upstream template (#71)
1 parent 7e25737 commit c0e1797

File tree

9 files changed

+143
-123
lines changed

9 files changed

+143
-123
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

+9
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@ terraform.rc
3030
.DS_Store
3131
todo.md
3232

33+
# Ignore vim swap files
34+
*.swp
35+
*.swo
36+
37+
# Irgnore meld diff files
38+
*.orig
39+
*.backup
40+
*.rej
41+

.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

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

7+
plugin "terraform" {
8+
enabled = true
9+
version = "0.9.1"
10+
source = "github.com/terraform-linters/tflint-ruleset-terraform"
11+
}
12+
713
config {
8-
module = true
9-
force = false
14+
call_module_type = "local"
15+
force = false
1016
}
1117

1218
rule "terraform_required_providers" {

Makefile

+69-57
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#
2-
# Copyright (C) 2024 Appvia Ltd <[email protected]>
3-
#
42
# This program is free software; you can redistribute it and/or
53
# modify it under the terms of the GNU General Public License
64
# as published by the Free Software Foundation; either version 2
@@ -14,43 +12,59 @@
1412
# You should have received a copy of the GNU General Public License
1513
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1614
#
17-
AUTHOR_EMAIL[email protected]
18-
19-
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init examples
15+
.PHONY: all security lint format documentation documentation-examples validate-all validate validate-examples init examples tests
2016

2117
default: all
2218

2319
all:
2420
$(MAKE) init
2521
$(MAKE) validate
22+
$(MAKE) tests
2623
$(MAKE) lint
2724
$(MAKE) security
2825
$(MAKE) format
2926
$(MAKE) documentation
3027

31-
examples:
32-
@echo "--> Running examples"
33-
$(MAKE) documentation
34-
$(MAKE) validate-examples
28+
examples:
29+
$(MAKE) validate-examples
30+
$(MAKE) tests
3531
$(MAKE) lint-examples
36-
$(MAKE) security-examples
32+
$(MAKE) lint
33+
$(MAKE) security
34+
$(MAKE) format
35+
$(MAKE) documentation
3736

3837
documentation:
3938
@echo "--> Generating documentation"
40-
@terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject .
39+
@terraform-docs .
4140
$(MAKE) documentation-modules
4241
$(MAKE) documentation-examples
4342

4443
documentation-modules:
4544
@echo "--> Generating documentation for modules"
46-
@if [ -d modules ]; then \
47-
find modules -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
48-
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;
4949

5050
documentation-examples:
51-
@echo "--> Generating documentation examples"
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;
56+
57+
upgrade-terraform-providers:
58+
@printf "%s Upgrading Terraform providers for %-24s" "-->" "."
59+
@terraform init -upgrade >/dev/null && echo "[OK]" || echo "[FAILED]"
60+
@$(MAKE) upgrade-terraform-example-providers
61+
62+
upgrade-terraform-example-providers:
5263
@if [ -d examples ]; then \
53-
find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
64+
find examples -type d -mindepth 1 -maxdepth 1 2>/dev/null | while read -r dir; do \
65+
printf "%s Upgrading Terraform providers for %-24s" "-->" "$$dir"; \
66+
terraform -chdir=$$dir init -upgrade >/dev/null && echo "[OK]" || echo "[FAILED]"; \
67+
done; \
5468
fi
5569

5670
init:
@@ -65,48 +79,50 @@ security:
6579

6680
security-modules:
6781
@echo "--> Running Security checks on modules"
68-
@if [ -d modules ]; then \
69-
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
70-
echo "--> Validating $$dir"; \
71-
trivy config $$dir; \
72-
done; \
73-
fi
82+
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
83+
echo "--> Validating $$dir"; \
84+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
85+
done;
7486

7587
security-examples:
7688
@echo "--> Running Security checks on examples"
77-
@if [ -d examples ]; then \
78-
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
79-
echo "--> Validating $$dir"; \
80-
trivy config $$dir; \
81-
done; \
82-
fi
89+
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
90+
echo "--> Validating $$dir"; \
91+
trivy config --format table --exit-code 1 --severity CRITICAL,HIGH --ignorefile .trivyignore $$dir; \
92+
done;
93+
94+
tests:
95+
@echo "--> Running Terraform Tests"
96+
@terraform test
8397

8498
validate:
8599
@echo "--> Running terraform validate"
86100
@terraform init -backend=false
87101
@terraform validate
88102
$(MAKE) validate-modules
89103
$(MAKE) validate-examples
104+
$(MAKE) validate-commits
90105

91106
validate-modules:
92107
@echo "--> Running terraform validate on modules"
93-
@if [ -d modules ]; then \
94-
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
95-
echo "--> Validating $$dir"; \
96-
terraform -chdir=$$dir init -backend=false; \
97-
terraform -chdir=$$dir validate; \
98-
done; \
99-
fi
108+
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
109+
echo "--> Validating Module $$dir"; \
110+
terraform -chdir=$$dir init -backend=false; \
111+
terraform -chdir=$$dir validate; \
112+
done;
100113

101114
validate-examples:
102115
@echo "--> Running terraform validate on examples"
103-
@if [ -d examples ]; then \
104-
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
105-
echo "--> Validating $$dir"; \
106-
terraform -chdir=$$dir init -backend=false; \
107-
terraform -chdir=$$dir validate; \
108-
done; \
109-
fi
116+
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
117+
echo "--> Validating $$dir"; \
118+
terraform -chdir=$$dir init -backend=false; \
119+
terraform -chdir=$$dir validate; \
120+
done;
121+
122+
validate-commits:
123+
@echo "--> Running commitlint against the main branch"
124+
@command -v commitlint >/dev/null 2>&1 || { echo "commitlint is not installed. Please install it by running 'npm install -g commitlint'"; exit 1; }
125+
@git log --pretty=format:"%s" origin/main..HEAD | commitlint --from=origin/main
110126

111127
lint:
112128
@echo "--> Running tflint"
@@ -117,31 +133,27 @@ lint:
117133

118134
lint-modules:
119135
@echo "--> Running tflint on modules"
120-
@if [ -d modules ]; then \
121-
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
122-
echo "--> Linting $$dir"; \
123-
tflint --chdir=$$dir --init; \
124-
tflint --chdir=$$dir -f compact; \
125-
done; \
126-
fi
136+
@find . -type d -regex '.*/modules/[a-zA-Z\-_$$]*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
137+
echo "--> Linting $$dir"; \
138+
tflint --chdir=$$dir --init; \
139+
tflint --chdir=$$dir -f compact; \
140+
done;
127141

128142
lint-examples:
129143
@echo "--> Running tflint on examples"
130-
@if [ -d examples ]; then \
131-
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
132-
echo "--> Linting $$dir"; \
133-
tflint --chdir=$$dir --init; \
134-
tflint --chdir=$$dir -f compact; \
135-
done; \
136-
fi
144+
@find . -type d -path '*/examples/*' -not -path '*.terraform*' 2>/dev/null | while read -r dir; do \
145+
echo "--> Linting $$dir"; \
146+
tflint --chdir=$$dir --init; \
147+
tflint --chdir=$$dir -f compact; \
148+
done;
137149

138150
format:
139151
@echo "--> Running terraform fmt"
140152
@terraform fmt -recursive -write=true
141153

142154
clean:
143155
@echo "--> Cleaning up"
144-
@find . -type d -name ".terraform" | while read -r dir; do \
156+
@find . -type d -name ".terraform" 2>/dev/null | while read -r dir; do \
145157
echo "--> Removing $$dir"; \
146158
rm -rf $$dir; \
147159
done

README.md

-41
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@ The `terraform-docs` utility is used to generate this README. Follow the below s
8282
To enable the Cora Data Exports, please see https://catalog.workshops.aws/awscid/en-US/dashboards/additional/cora for more information, you simply have to enable the `var.enable_cora_data_exports`. This will deploy an additional [cloudformation](./assets/cloudformation/cudos/data-exports-aggregation.yaml) with the management account.
8383

8484
<!-- BEGIN_TF_DOCS -->
85-
## Requirements
86-
87-
| Name | Version |
88-
|------|---------|
89-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
90-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 5.0 |
91-
9285
## Providers
9386

9487
| Name | Version |
@@ -97,40 +90,6 @@ To enable the Cora Data Exports, please see https://catalog.workshops.aws/awscid
9790
| <a name="provider_aws.cost_analysis"></a> [aws.cost\_analysis](#provider\_aws.cost\_analysis) | ~> 5.0 |
9891
| <a name="provider_aws.management"></a> [aws.management](#provider\_aws.management) | ~> 5.0 |
9992

100-
## Modules
101-
102-
| Name | Source | Version |
103-
|------|--------|---------|
104-
| <a name="module_cloudformation_bucket"></a> [cloudformation\_bucket](#module\_cloudformation\_bucket) | terraform-aws-modules/s3-bucket/aws | 4.1.2 |
105-
| <a name="module_collector"></a> [collector](#module\_collector) | github.com/aws-samples/aws-cudos-framework-deployment//terraform-modules/cur-setup-destination | 0.3.10 |
106-
| <a name="module_dashboard_bucket"></a> [dashboard\_bucket](#module\_dashboard\_bucket) | terraform-aws-modules/s3-bucket/aws | 4.1.2 |
107-
| <a name="module_dashboards"></a> [dashboards](#module\_dashboards) | github.com/aws-samples/aws-cudos-framework-deployment//terraform-modules/cid-dashboards | 0.3.10 |
108-
| <a name="module_source"></a> [source](#module\_source) | github.com/aws-samples/aws-cudos-framework-deployment//terraform-modules/cur-setup-source | 0.3.10 |
109-
110-
## Resources
111-
112-
| Name | Type |
113-
|------|------|
114-
| [aws_cloudformation_stack.cora_data_export_collector](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack) | resource |
115-
| [aws_cloudformation_stack.core_data_export_management](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack) | resource |
116-
| [aws_cloudformation_stack.cudos_data_collection](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack) | resource |
117-
| [aws_cloudformation_stack.cudos_read_permissions](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack) | resource |
118-
| [aws_iam_role.cudos_sso](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
119-
| [aws_iam_saml_provider.saml](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_saml_provider) | resource |
120-
| [aws_quicksight_account_subscription.subscription](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/quicksight_account_subscription) | resource |
121-
| [aws_quicksight_group.groups](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/quicksight_group) | resource |
122-
| [aws_quicksight_group_membership.members](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/quicksight_group_membership) | resource |
123-
| [aws_quicksight_user.users](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/quicksight_user) | resource |
124-
| [aws_s3_object.cloudformation_templates](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_object) | resource |
125-
| [aws_caller_identity.cost_analysis](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
126-
| [aws_caller_identity.management](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
127-
| [aws_iam_policy_document.cudos_sso](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
128-
| [aws_iam_policy_document.cudos_sso_permissions](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
129-
| [aws_iam_policy_document.dashboards_bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
130-
| [aws_iam_policy_document.stack_bucket_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
131-
| [aws_organizations_organization.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_organization) | data source |
132-
| [aws_region.cost_analysis](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
133-
13493
## Inputs
13594

13695
| Name | Description | Type | Default | Required |

examples/basic/README.md

-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
11
<!-- BEGIN_TF_DOCS -->
2-
## Requirements
3-
4-
| Name | Version |
5-
|------|---------|
6-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0.0 |
8-
| <a name="requirement_awscc"></a> [awscc](#requirement\_awscc) | >= 0.11.0 |
9-
102
## Providers
113

124
No providers.
135

14-
## Modules
15-
16-
| Name | Source | Version |
17-
|------|--------|---------|
18-
| <a name="module_cudos_framework"></a> [cudos\_framework](#module\_cudos\_framework) | ../.. | n/a |
19-
20-
## Resources
21-
22-
No resources.
23-
246
## Inputs
257

268
| Name | Description | Type | Default | Required |

examples/basic/assets/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 -->

examples/basic/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 -->

0 commit comments

Comments
 (0)