Skip to content

Commit

Permalink
feat: pre-commit autoupdate and terraform_docs (#247)
Browse files Browse the repository at this point in the history
* feat: pre-commit autoupdate and terraform_docs
  • Loading branch information
esacteksab authored Jan 11, 2025
1 parent 8d84f1b commit fe7c309
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .markdownlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
22 changes: 6 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,27 +14,17 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
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.33.0
rev: v0.43.0
hooks:
- id: markdownlint

- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.5
- repo: https://github.com/terraform-docs/terraform-docs
rev: "v0.19.0"
hooks:
- id: shell-lint
- id: terraform-docs-go

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.1
rev: v1.96.3
hooks:
- id: terraform_fmt
31 changes: 31 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
version: ">= 0.19.0, < 1.0.0"

settings:
html: false
anchor: false
escape: false
lockfile: false
hide-empty: true
formatter: "markdown table"

sort:
enabled: true
by: required

sections:
show:
- requirements
- providers
- modules
- data-sources
- resources
- inputs
- outputs

recursive:
enabled: false
include-main: false

output:
file: README.md
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
File renamed without changes.
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ previous invocations of the module prior to upgrading the version.
|------|---------|
| aws | >= 3.0 |

## Modules

No modules.

## Resources

| Name | Type |
Expand All @@ -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 |
| 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 |
| 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_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 |
<!-- END_TF_DOCS -->

## Developer Setup
Expand Down
27 changes: 27 additions & 0 deletions examples/simple/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# simple

<!-- BEGIN_TF_DOCS -->


## 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 |
<!-- END_TF_DOCS -->

0 comments on commit fe7c309

Please sign in to comment.