From d9fed912ab494d92420c753e549a41682294c839 Mon Sep 17 00:00:00 2001
From: Barry Morrison <689591+esacteksab@users.noreply.github.com>
Date: Sat, 11 Jan 2025 10:55:33 -0600
Subject: [PATCH] feat: pre-commit autoupdate and terraform_docs adoption (#49)
* chore: pre-commit autoupdate and terraform_docs adoption
* docs: updated pre-commit, terraform_docs and markdownlint
---
.markdownlintrc | 3 +-
.pre-commit-config.yaml | 12 ++++--
.terraform-docs.yml | 25 ++++++++++++
README.md | 84 ++++++++++++++++++++---------------------
4 files changed, 76 insertions(+), 48 deletions(-)
create mode 100644 .terraform-docs.yml
diff --git a/.markdownlintrc b/.markdownlintrc
index 83eb43d..3e0ef98 100644
--- a/.markdownlintrc
+++ b/.markdownlintrc
@@ -4,5 +4,6 @@
"first-line-h1": false,
"line_length": false,
"no-multiple-blanks": 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 65e2898..f20aa47 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.0.1
+ rev: v5.0.0
hooks:
- id: check-json
- id: check-merge-conflict
@@ -12,11 +12,17 @@ repos:
- id: trailing-whitespace
- repo: https://github.com/igorshubovych/markdownlint-cli
- rev: v0.28.1
+ rev: v0.43.0
hooks:
- id: markdownlint
- repo: https://github.com/antonbabenko/pre-commit-terraform
- rev: v1.50.0
+ 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
new file mode 100644
index 0000000..bdd6960
--- /dev/null
+++ b/.terraform-docs.yml
@@ -0,0 +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 633577d..14fffd0 100644
--- a/README.md
+++ b/README.md
@@ -67,18 +67,14 @@ module "s3_anti_virus" {
| Name | Version |
|------|---------|
-| [terraform](#requirement\_terraform) | >= 1.0 |
-| [aws](#requirement\_aws) | >= 3.0 |
+| terraform | >= 1.0 |
+| aws | >= 3.0 |
## Providers
| Name | Version |
|------|---------|
-| [aws](#provider\_aws) | >= 3.0 |
-
-## Modules
-
-No modules.
+| aws | >= 3.0 |
## Resources
@@ -110,46 +106,46 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
-| [av\_definition\_s3\_bucket](#input\_av\_definition\_s3\_bucket) | Bucket containing antivirus database files. | `string` | n/a | yes |
-| [av\_definition\_s3\_prefix](#input\_av\_definition\_s3\_prefix) | Prefix for antivirus database files. | `string` | `"clamav_defs"` | no |
-| [av\_delete\_infected\_files](#input\_av\_delete\_infected\_files) | Set it True in order to delete infected values. | `string` | `"False"` | no |
-| [av\_scan\_buckets](#input\_av\_scan\_buckets) | A list of S3 bucket names to scan for viruses. | `list(string)` | n/a | yes |
-| [av\_scan\_start\_sns\_arn](#input\_av\_scan\_start\_sns\_arn) | SNS topic ARN to publish notification about start of scan (optional). | `string` | `""` | no |
-| [av\_status\_sns\_arn](#input\_av\_status\_sns\_arn) | SNS topic ARN to publish scan results (optional). | `string` | `""` | no |
-| [av\_status\_sns\_publish\_clean](#input\_av\_status\_sns\_publish\_clean) | Publish AV\_STATUS\_CLEAN results to AV\_STATUS\_SNS\_ARN. | `string` | `"True"` | no |
-| [av\_status\_sns\_publish\_infected](#input\_av\_status\_sns\_publish\_infected) | Publish AV\_STATUS\_INFECTED results to AV\_STATUS\_SNS\_ARN. | `string` | `"True"` | no |
-| [av\_update\_minutes](#input\_av\_update\_minutes) | How often to download updated Anti-Virus databases. | `string` | `180` | no |
-| [cloudwatch\_kms\_arn](#input\_cloudwatch\_kms\_arn) | The arn of the kms key used for encrypting the cloudwatch log groups created by this module. | `string` | `""` | no |
-| [cloudwatch\_logs\_retention\_days](#input\_cloudwatch\_logs\_retention\_days) | Number of days to keep logs in AWS CloudWatch. | `string` | `90` | no |
-| [kms\_key\_sns\_arn](#input\_kms\_key\_sns\_arn) | ARN of the KMS Key to use for SNS Encryption | `string` | `""` | no |
-| [lambda\_package](#input\_lambda\_package) | The name of the lambda package. Used for a directory tree and zip file. | `string` | `"anti-virus"` | no |
-| [lambda\_package\_key](#input\_lambda\_package\_key) | The object key for the lambda distribution. If given, the value is used as the key in lieu of the value constructed using `lambda_package` and `lambda_version`. | `string` | `null` | no |
-| [lambda\_s3\_bucket](#input\_lambda\_s3\_bucket) | The name of the S3 bucket used to store the Lambda builds. | `string` | n/a | yes |
-| [lambda\_version](#input\_lambda\_version) | The version the Lambda function to deploy. | `any` | n/a | yes |
-| [memory\_size](#input\_memory\_size) | Lambda memory allocation, in MB | `string` | `2048` | no |
-| [name\_scan](#input\_name\_scan) | Name for resources associated with anti-virus scanning | `string` | `"s3-anti-virus-scan"` | no |
-| [name\_update](#input\_name\_update) | Name for resources associated with anti-virus updating | `string` | `"s3-anti-virus-updates"` | no |
-| [permissions\_boundary](#input\_permissions\_boundary) | ARN of the boundary policy to attach to IAM roles. | `string` | `null` | no |
-| [skip\_s3\_notification](#input\_skip\_s3\_notification) | Boolean indicating if the bucket notification should not be added. This module implementation will not operate without a bucket notification. However, since bucket notifications can only be managed once, if an implementer wants additional notifications on the bucket, they must be managed outside this module. If you give this variable as `true`, you *must* add a bucket notification to the lambda given in outputs as `scan_lambda_function_arn`. See [this issue (#510) on the provider](https://github.com/hashicorp/terraform-provider-aws/issues/501#issuecomment-445106037) for more details on the topic. | `bool` | `false` | no |
-| [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
-| [timeout\_seconds](#input\_timeout\_seconds) | Lambda timeout, in seconds | `string` | `300` | no |
+| av_definition_s3_bucket | Bucket containing antivirus database files. | `string` | n/a | yes |
+| av_definition_s3_prefix | Prefix for antivirus database files. | `string` | `"clamav_defs"` | no |
+| av_delete_infected_files | Set it True in order to delete infected values. | `string` | `"False"` | no |
+| av_scan_buckets | A list of S3 bucket names to scan for viruses. | `list(string)` | n/a | yes |
+| av_scan_start_sns_arn | SNS topic ARN to publish notification about start of scan (optional). | `string` | `""` | no |
+| av_status_sns_arn | SNS topic ARN to publish scan results (optional). | `string` | `""` | no |
+| av_status_sns_publish_clean | Publish AV_STATUS_CLEAN results to AV_STATUS_SNS_ARN. | `string` | `"True"` | no |
+| av_status_sns_publish_infected | Publish AV_STATUS_INFECTED results to AV_STATUS_SNS_ARN. | `string` | `"True"` | no |
+| av_update_minutes | How often to download updated Anti-Virus databases. | `string` | `180` | no |
+| cloudwatch_kms_arn | The arn of the kms key used for encrypting the cloudwatch log groups created by this module. | `string` | `""` | no |
+| cloudwatch_logs_retention_days | Number of days to keep logs in AWS CloudWatch. | `string` | `90` | no |
+| kms_key_sns_arn | ARN of the KMS Key to use for SNS Encryption | `string` | `""` | no |
+| lambda_package | The name of the lambda package. Used for a directory tree and zip file. | `string` | `"anti-virus"` | no |
+| lambda_package_key | The object key for the lambda distribution. If given, the value is used as the key in lieu of the value constructed using `lambda_package` and `lambda_version`. | `string` | `null` | no |
+| lambda_s3_bucket | The name of the S3 bucket used to store the Lambda builds. | `string` | n/a | yes |
+| lambda_version | The version the Lambda function to deploy. | `any` | n/a | yes |
+| memory_size | Lambda memory allocation, in MB | `string` | `2048` | no |
+| name_scan | Name for resources associated with anti-virus scanning | `string` | `"s3-anti-virus-scan"` | no |
+| name_update | Name for resources associated with anti-virus updating | `string` | `"s3-anti-virus-updates"` | no |
+| permissions_boundary | ARN of the boundary policy to attach to IAM roles. | `string` | `null` | no |
+| skip_s3_notification | Boolean indicating if the bucket notification should not be added. This module implementation will not operate without a bucket notification. However, since bucket notifications can only be managed once, if an implementer wants additional notifications on the bucket, they must be managed outside this module. If you give this variable as `true`, you *must* add a bucket notification to the lambda given in outputs as `scan_lambda_function_arn`. See [this issue (#510) on the provider](https://github.com/hashicorp/terraform-provider-aws/issues/501#issuecomment-445106037) for more details on the topic. | `bool` | `false` | no |
+| tags | A map of tags to add to all resources. | `map(string)` | `{}` | no |
+| timeout_seconds | Lambda timeout, in seconds | `string` | `300` | no |
## Outputs
| Name | Description |
|------|-------------|
-| [scan\_aws\_cloudwatch\_log\_group\_arn](#output\_scan\_aws\_cloudwatch\_log\_group\_arn) | ARN for the Anti-Virus Scanning Cloudwatch LogGroup. |
-| [scan\_aws\_cloudwatch\_log\_group\_name](#output\_scan\_aws\_cloudwatch\_log\_group\_name) | The Anti-Virus Scanning Cloudwatch LogGroup name. |
-| [scan\_lambda\_function\_arn](#output\_scan\_lambda\_function\_arn) | ARN for the Anti-Virus Scanning lambda function. |
-| [scan\_lambda\_function\_iam\_role\_arn](#output\_scan\_lambda\_function\_iam\_role\_arn) | Name of the Anti-Virus Scanning lambda role. |
-| [scan\_lambda\_function\_iam\_role\_name](#output\_scan\_lambda\_function\_iam\_role\_name) | Name of the Anti-Virus Scanning lambda role. |
-| [scan\_lambda\_function\_name](#output\_scan\_lambda\_function\_name) | The Anti-Virus Scanning lambda function name. |
-| [scan\_lambda\_function\_version](#output\_scan\_lambda\_function\_version) | Current version of the Anti-Virus Scanning lambda function. |
-| [update\_aws\_cloudwatch\_log\_group\_arn](#output\_update\_aws\_cloudwatch\_log\_group\_arn) | ARN for the Anti-Virus Definitions Cloudwatch LogGroup. |
-| [update\_aws\_cloudwatch\_log\_group\_name](#output\_update\_aws\_cloudwatch\_log\_group\_name) | The Anti-Virus Definitions Cloudwatch LogGroup name. |
-| [update\_lambda\_function\_arn](#output\_update\_lambda\_function\_arn) | ARN for the Anti-Virus Definitions lambda function. |
-| [update\_lambda\_function\_iam\_role\_arn](#output\_update\_lambda\_function\_iam\_role\_arn) | ARN of the Anti-Virus Definitions lambda role. |
-| [update\_lambda\_function\_iam\_role\_name](#output\_update\_lambda\_function\_iam\_role\_name) | Name of the Anti-Virus Definitions lambda role. |
-| [update\_lambda\_function\_name](#output\_update\_lambda\_function\_name) | The Anti-Virus Definitions lambda function name. |
-| [update\_lambda\_function\_version](#output\_update\_lambda\_function\_version) | Current version of the Anti-Virus Definitions lambda function. |
+| scan_aws_cloudwatch_log_group_arn | ARN for the Anti-Virus Scanning Cloudwatch LogGroup. |
+| scan_aws_cloudwatch_log_group_name | The Anti-Virus Scanning Cloudwatch LogGroup name. |
+| scan_lambda_function_arn | ARN for the Anti-Virus Scanning lambda function. |
+| scan_lambda_function_iam_role_arn | Name of the Anti-Virus Scanning lambda role. |
+| scan_lambda_function_iam_role_name | Name of the Anti-Virus Scanning lambda role. |
+| scan_lambda_function_name | The Anti-Virus Scanning lambda function name. |
+| scan_lambda_function_version | Current version of the Anti-Virus Scanning lambda function. |
+| update_aws_cloudwatch_log_group_arn | ARN for the Anti-Virus Definitions Cloudwatch LogGroup. |
+| update_aws_cloudwatch_log_group_name | The Anti-Virus Definitions Cloudwatch LogGroup name. |
+| update_lambda_function_arn | ARN for the Anti-Virus Definitions lambda function. |
+| update_lambda_function_iam_role_arn | ARN of the Anti-Virus Definitions lambda role. |
+| update_lambda_function_iam_role_name | Name of the Anti-Virus Definitions lambda role. |
+| update_lambda_function_name | The Anti-Virus Definitions lambda function name. |
+| update_lambda_function_version | Current version of the Anti-Virus Definitions lambda function. |
\ No newline at end of file