From 2296cbc98c9d88f74b817952e47f3ab28bb38f9e Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 11:10:48 -0600 Subject: [PATCH 01/11] feat: pre-commit autoupdate and terraform_docs --- .markdownlintrc | 4 ++-- .pre-commit-config.yaml | 19 ++++++++++--------- .terraform-docs.yml | 21 +++++++++++++++++++++ README.md | 34 +++++++++++++++------------------- examples/simple/README.md | 27 +++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 30 deletions(-) create mode 100644 examples/simple/README.md diff --git a/.markdownlintrc b/.markdownlintrc index c555be2..3e0ef98 100644 --- a/.markdownlintrc +++ b/.markdownlintrc @@ -4,6 +4,6 @@ "first-line-h1": false, "line_length": false, "no-multiple-blanks": false, - "commands-show-output": false, - "no-inline-html": false + "no-inline-html": false, + "no-alt-text": false } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bfd87bb..f930aa6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: check-json - id: check-merge-conflict @@ -15,7 +15,7 @@ repos: - id: mixed-line-ending - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.21 hooks: - id: mdformat additional_dependencies: @@ -25,16 +25,17 @@ repos: exclude: README.m(ark)?d(own)? - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 + rev: v0.43.0 hooks: - id: markdownlint - - repo: https://github.com/detailyang/pre-commit-shell - rev: 1.0.5 - hooks: - - id: shell-lint - - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.77.1 + rev: v1.96.3 hooks: - id: terraform_fmt + - id: terraform_docs + args: + - --args=--config=.terraform-docs.yml + - --hook-config=--path-to-file=README.md + - --hook-config=--add-to-existing-file=true + - --hook-config=--create-file-if-not-exist=true diff --git a/.terraform-docs.yml b/.terraform-docs.yml index fb05467..8b4c387 100644 --- a/.terraform-docs.yml +++ b/.terraform-docs.yml @@ -1,4 +1,25 @@ settings: html: false anchor: false + escape: false + lockfile: false + hide-empty: true formatter: "markdown table" + +sections: + show: + - requirements + - providers + - modules + - data-sources + - resources + - inputs + - outputs + +output: + file: README.md + mode: inject + template: |- + + {{ .Content }} + diff --git a/README.md b/README.md index 02a5866..c9f3755 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,6 @@ previous invocations of the module prior to upgrading the version. |------|---------| | aws | >= 3.0 | -## Modules - -No modules. - ## Resources | Name | Type | @@ -61,28 +57,28 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| api\_call\_rate\_insight | A measurement of write-only management API calls that occur per minute against a baseline API call volume. | `bool` | `false` | no | -| api\_error\_rate\_insight | A measurement of management API calls that result in error codes. The error is shown if the API call is unsuccessful. | `bool` | `false` | no | -| cloudwatch\_log\_group\_name | The name of the CloudWatch Log Group that receives CloudTrail events. | `string` | `"cloudtrail-events"` | no | +| api_call_rate_insight | A measurement of write-only management API calls that occur per minute against a baseline API call volume. | `bool` | `false` | no | +| api_error_rate_insight | A measurement of management API calls that result in error codes. The error is shown if the API call is unsuccessful. | `bool` | `false` | no | +| cloudwatch_log_group_name | The name of the CloudWatch Log Group that receives CloudTrail events. | `string` | `"cloudtrail-events"` | no | | enabled | Enables logging for the trail. Defaults to true. Setting this to false will pause logging. | `bool` | `true` | no | -| iam\_policy\_name | Name for the CloudTrail IAM policy | `string` | `"cloudtrail-cloudwatch-logs-policy"` | no | -| iam\_role\_name | Name for the CloudTrail IAM role | `string` | `"cloudtrail-cloudwatch-logs-role"` | no | -| key\_deletion\_window\_in\_days | Duration in days after which the key is deleted after destruction of the resource, must be 7-30 days. Default 30 days. | `string` | `30` | no | -| log\_retention\_days | Number of days to keep AWS logs around in specific log group. | `string` | `90` | no | -| org\_trail | Whether or not this is an organization trail. Only valid in master account. | `string` | `"false"` | no | -| s3\_bucket\_name | The name of the AWS S3 bucket. | `string` | n/a | yes | -| s3\_key\_prefix | S3 key prefix for CloudTrail logs | `string` | `"cloudtrail"` | no | -| sns\_topic\_arn | ARN of the SNS topic for notification of log file delivery. | `string` | `""` | no | +| iam_policy_name | Name for the CloudTrail IAM policy | `string` | `"cloudtrail-cloudwatch-logs-policy"` | no | +| iam_role_name | Name for the CloudTrail IAM role | `string` | `"cloudtrail-cloudwatch-logs-role"` | no | +| key_deletion_window_in_days | Duration in days after which the key is deleted after destruction of the resource, must be 7-30 days. Default 30 days. | `string` | `30` | no | +| log_retention_days | Number of days to keep AWS logs around in specific log group. | `string` | `90` | no | +| org_trail | Whether or not this is an organization trail. Only valid in master account. | `string` | `"false"` | no | +| s3_bucket_name | The name of the AWS S3 bucket. | `string` | n/a | yes | +| s3_key_prefix | S3 key prefix for CloudTrail logs | `string` | `"cloudtrail"` | no | +| sns_topic_arn | ARN of the SNS topic for notification of log file delivery. | `string` | `""` | no | | tags | A mapping of tags to CloudTrail resources. | `map(string)` | `{}` | no | -| trail\_name | Name for the Cloudtrail | `string` | `"cloudtrail"` | no | +| trail_name | Name for the Cloudtrail | `string` | `"cloudtrail"` | no | ## Outputs | Name | Description | |------|-------------| -| cloudtrail\_arn | CloudTrail ARN | -| cloudtrail\_home\_region | CloudTrail Home Region | -| cloudtrail\_id | CloudTrail ID | +| cloudtrail_arn | CloudTrail ARN | +| cloudtrail_home_region | CloudTrail Home Region | +| cloudtrail_id | CloudTrail ID | ## Developer Setup diff --git a/examples/simple/README.md b/examples/simple/README.md new file mode 100644 index 0000000..304c861 --- /dev/null +++ b/examples/simple/README.md @@ -0,0 +1,27 @@ +# simple + + + + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| aws_cloudtrail | ../../ | n/a | +| logs | trussworks/logs/aws | ~> 12 | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| cloudwatch_log_group_name | n/a | `string` | n/a | yes | +| logs_bucket | n/a | `string` | n/a | yes | +| s3_key_prefix | n/a | `string` | n/a | yes | +| trail_name | n/a | `string` | n/a | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| cloudtrail_arn | CloudTrail ARN | + From 72ec0d00c3881799b79eeb91708c4c42ce2c8ba1 Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 11:22:11 -0600 Subject: [PATCH 02/11] ci: removing mdformat --- .pre-commit-config.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f930aa6..ca61b06 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,16 +14,6 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending - - repo: https://github.com/executablebooks/mdformat - rev: 0.7.21 - hooks: - - id: mdformat - additional_dependencies: - - mdformat-gfm - - mdformat-toc - # mdformat fights with terraform_docs - exclude: README.m(ark)?d(own)? - - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.43.0 hooks: From a7aa982920a78dcfeddce471ccb2e4b459a948bc Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 11:44:09 -0600 Subject: [PATCH 03/11] fix: exclude LICENSE from terraform_docs --- .pre-commit-config.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ca61b06..71b4f2c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,7 @@ repos: - id: terraform_docs args: - --args=--config=.terraform-docs.yml - - --hook-config=--path-to-file=README.md - - --hook-config=--add-to-existing-file=true - - --hook-config=--create-file-if-not-exist=true + exclude: | + (?x)^( + LICENSE + )$ From 08a10ff8d8c07436d174cf3f8c922507b4cce41d Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 11:47:24 -0600 Subject: [PATCH 04/11] fix: don't add to or create new file --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71b4f2c..1c85f62 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,8 @@ repos: - id: terraform_docs args: - --args=--config=.terraform-docs.yml + - --hook-config=--add-to-existing-file=false + - --hook-config=--create-file-if-not-exist=false exclude: | (?x)^( LICENSE From 95a1ab53512876f3405e88f4cc5190b993a8a54b Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 12:01:50 -0600 Subject: [PATCH 05/11] fix: terraform_docs --- .pre-commit-config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c85f62..d52c110 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,10 +24,12 @@ repos: hooks: - id: terraform_fmt - id: terraform_docs + verbose: true args: - --args=--config=.terraform-docs.yml - --hook-config=--add-to-existing-file=false - --hook-config=--create-file-if-not-exist=false + files: ^.*\.tf$ exclude: | (?x)^( LICENSE From 1b9db1932cc83edca688778d2eba28cbd1a00374 Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 12:17:33 -0600 Subject: [PATCH 06/11] fix: terraform_docs --- .pre-commit-config.yaml | 5 ----- .terraform-docs.yml | 2 ++ LICENSE => LICENSE.txt | 0 3 files changed, 2 insertions(+), 5 deletions(-) rename LICENSE => LICENSE.txt (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d52c110..b9f089a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,8 +29,3 @@ repos: - --args=--config=.terraform-docs.yml - --hook-config=--add-to-existing-file=false - --hook-config=--create-file-if-not-exist=false - files: ^.*\.tf$ - exclude: | - (?x)^( - LICENSE - )$ diff --git a/.terraform-docs.yml b/.terraform-docs.yml index 8b4c387..8168d13 100644 --- a/.terraform-docs.yml +++ b/.terraform-docs.yml @@ -1,3 +1,5 @@ +version: ">= 0.19.0, < 1.0.0" + settings: html: false anchor: false diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt From 6252a00057e6b0651e760dce112adc077724fdc6 Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 12:19:49 -0600 Subject: [PATCH 07/11] fix: terraform_docs --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b9f089a..20054e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,3 +29,4 @@ repos: - --args=--config=.terraform-docs.yml - --hook-config=--add-to-existing-file=false - --hook-config=--create-file-if-not-exist=false + - --args=--output-mode=inject From 7c070b469d2f16276092baec51e19e3e507f4570 Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 12:29:55 -0600 Subject: [PATCH 08/11] fix: sort by required --- .terraform-docs.yml | 4 ++++ README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.terraform-docs.yml b/.terraform-docs.yml index 8168d13..08831e9 100644 --- a/.terraform-docs.yml +++ b/.terraform-docs.yml @@ -8,6 +8,10 @@ settings: hide-empty: true formatter: "markdown table" +sort: + enabled: true + by: required + sections: show: - requirements diff --git a/README.md b/README.md index c9f3755..4b1e143 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ previous invocations of the module prior to upgrading the version. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| s3_bucket_name | The name of the AWS S3 bucket. | `string` | n/a | yes | | api_call_rate_insight | A measurement of write-only management API calls that occur per minute against a baseline API call volume. | `bool` | `false` | no | | api_error_rate_insight | A measurement of management API calls that result in error codes. The error is shown if the API call is unsuccessful. | `bool` | `false` | no | | cloudwatch_log_group_name | The name of the CloudWatch Log Group that receives CloudTrail events. | `string` | `"cloudtrail-events"` | no | @@ -66,7 +67,6 @@ previous invocations of the module prior to upgrading the version. | key_deletion_window_in_days | Duration in days after which the key is deleted after destruction of the resource, must be 7-30 days. Default 30 days. | `string` | `30` | no | | log_retention_days | Number of days to keep AWS logs around in specific log group. | `string` | `90` | no | | org_trail | Whether or not this is an organization trail. Only valid in master account. | `string` | `"false"` | no | -| s3_bucket_name | The name of the AWS S3 bucket. | `string` | n/a | yes | | s3_key_prefix | S3 key prefix for CloudTrail logs | `string` | `"cloudtrail"` | no | | sns_topic_arn | ARN of the SNS topic for notification of log file delivery. | `string` | `""` | no | | tags | A mapping of tags to CloudTrail resources. | `map(string)` | `{}` | no | From 40c160eea09506367b23076f1cfabbccba639151 Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 12:36:54 -0600 Subject: [PATCH 09/11] fix: terraform_docs --- .terraform-docs.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.terraform-docs.yml b/.terraform-docs.yml index 08831e9..39ca235 100644 --- a/.terraform-docs.yml +++ b/.terraform-docs.yml @@ -22,6 +22,10 @@ sections: - inputs - outputs +recursive: + enabled: false + include-main: false + output: file: README.md mode: inject From 3683e22e435a5907745e238ffd0660c1d88d58eb Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 13:03:26 -0600 Subject: [PATCH 10/11] fix: terraform_docs --- .pre-commit-config.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20054e8..73ccaca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,9 +24,5 @@ repos: hooks: - id: terraform_fmt - id: terraform_docs - verbose: true args: - --args=--config=.terraform-docs.yml - - --hook-config=--add-to-existing-file=false - - --hook-config=--create-file-if-not-exist=false - - --args=--output-mode=inject From d46721346cdd4dbcd377515c71a9f66d7c431109 Mon Sep 17 00:00:00 2001 From: Barry Morrison <689591+esacteksab@users.noreply.github.com> Date: Sat, 11 Jan 2025 13:16:17 -0600 Subject: [PATCH 11/11] fix: terraform_docs --- .pre-commit-config.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 73ccaca..51f1de1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,10 +19,12 @@ repos: hooks: - id: markdownlint + - repo: https://github.com/terraform-docs/terraform-docs + rev: "v0.19.0" + hooks: + - id: terraform-docs-go + - repo: https://github.com/antonbabenko/pre-commit-terraform rev: v1.96.3 hooks: - id: terraform_fmt - - id: terraform_docs - args: - - --args=--config=.terraform-docs.yml