Skip to content

Commit 0719fe3

Browse files
TECH-6356: Terraform Fixes (#41)
* Terraform Fixes * Adding tool-versions
1 parent 71bf7a7 commit 0719fe3

File tree

6 files changed

+154
-9
lines changed

6 files changed

+154
-9
lines changed

.pre-commit-config.yaml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
repos:
2-
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.12.0
4-
hooks:
5-
- id: terraform_fmt
6-
# - id: terraform_docs
7-
- repo: git://github.com/pre-commit/pre-commit-hooks
8-
rev: v2.2.3
9-
hooks:
10-
- id: check-merge-conflict
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
# Security
6+
- id: detect-aws-credentials
7+
args: ['--allow-missing-credentials']
8+
- id: detect-private-key
9+
10+
- repo: https://github.com/antonbabenko/pre-commit-terraform
11+
rev: v1.88.2
12+
hooks:
13+
# Terraform
14+
- id: terraform_tflint
15+
- id: terraform_fmt
16+
args:
17+
- --args=-write
18+
- --args=-recursive
19+
- --args=-diff
20+
- id: terraform_docs
21+
args:
22+
- --hook-config=--add-to-existing-file=true
23+
- --hook-config=--create-file-if-not-exist=true
24+
- --hook-config=--use-standard-markers=true

.terraform-docs.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
formatter: "markdown" # this is required
2+
3+
version: "~> 0.17.0"
4+
5+
header-from: main.tf
6+
footer-from: ""
7+
8+
recursive:
9+
enabled: false # true if modules folder exists
10+
11+
sections:
12+
hide: []
13+
show: []
14+
15+
content: ""
16+
17+
output:
18+
# file: "" # this is correct for recursive enabled false
19+
file: "README.md" # for recursive enabled true
20+
mode: inject
21+
template: |-
22+
<!-- BEGIN_TF_DOCS -->
23+
{{ .Content }}
24+
<!-- END_TF_DOCS -->
25+
26+
output-values:
27+
enabled: false
28+
from: ""
29+
30+
sort:
31+
enabled: true
32+
by: name
33+
34+
settings:
35+
anchor: true
36+
color: true
37+
default: true
38+
description: true
39+
escape: true
40+
hide-empty: false
41+
html: true
42+
indent: 2
43+
lockfile: true
44+
read-comments: true
45+
required: true
46+
sensitive: true
47+
type: true

.tool-versions

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
terraform 1.5.7
2+
pre-commit 3.6.2
3+
terraform-docs 0.17.0

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,6 @@ Module managed by [Anton Babenko](https://github.com/antonbabenko).
8686
## License
8787

8888
Apache 2 Licensed. See LICENSE for full details.
89+
<!-- BEGIN_TF_DOCS -->
90+
README.md updated successfully
91+
<!-- END_TF_DOCS -->

examples/cloudwatch-alerts-to-slack/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,45 @@ Note that this example may create resources which can cost money. Run `terraform
7070
| this_sns_topic_arn | The ARN of the created SNS topic from which messages will be sent to Slack |
7171

7272
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
73+
<!-- BEGIN_TF_DOCS -->
74+
## Requirements
75+
76+
No requirements.
77+
78+
## Providers
79+
80+
| Name | Version |
81+
|------|---------|
82+
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
83+
84+
## Modules
85+
86+
| Name | Source | Version |
87+
|------|--------|---------|
88+
| <a name="module_notify_slack"></a> [notify\_slack](#module\_notify\_slack) | ../../ | n/a |
89+
90+
## Resources
91+
92+
| Name | Type |
93+
|------|------|
94+
| [aws_cloudwatch_metric_alarm.LambdaDuration](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm) | resource |
95+
| [aws_kms_ciphertext.slack_url](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_ciphertext) | resource |
96+
| [aws_kms_key.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
97+
98+
## Inputs
99+
100+
No inputs.
101+
102+
## Outputs
103+
104+
| Name | Description |
105+
|------|-------------|
106+
| <a name="output_lambda_iam_role_arn"></a> [lambda\_iam\_role\_arn](#output\_lambda\_iam\_role\_arn) | The ARN of the IAM role used by Lambda function |
107+
| <a name="output_lambda_iam_role_name"></a> [lambda\_iam\_role\_name](#output\_lambda\_iam\_role\_name) | The name of the IAM role used by Lambda function |
108+
| <a name="output_notify_slack_lambda_function_arn"></a> [notify\_slack\_lambda\_function\_arn](#output\_notify\_slack\_lambda\_function\_arn) | The ARN of the Lambda function |
109+
| <a name="output_notify_slack_lambda_function_invoke_arn"></a> [notify\_slack\_lambda\_function\_invoke\_arn](#output\_notify\_slack\_lambda\_function\_invoke\_arn) | The ARN to be used for invoking Lambda function from API Gateway |
110+
| <a name="output_notify_slack_lambda_function_last_modified"></a> [notify\_slack\_lambda\_function\_last\_modified](#output\_notify\_slack\_lambda\_function\_last\_modified) | The date Lambda function was last modified |
111+
| <a name="output_notify_slack_lambda_function_name"></a> [notify\_slack\_lambda\_function\_name](#output\_notify\_slack\_lambda\_function\_name) | The name of the Lambda function |
112+
| <a name="output_notify_slack_lambda_function_version"></a> [notify\_slack\_lambda\_function\_version](#output\_notify\_slack\_lambda\_function\_version) | Latest published version of your Lambda function |
113+
| <a name="output_this_sns_topic_arn"></a> [this\_sns\_topic\_arn](#output\_this\_sns\_topic\_arn) | The ARN of the SNS topic from which messages will be sent to Slack |
114+
<!-- END_TF_DOCS -->

examples/notify-slack-simple/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,39 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2727
| sns_topic_arn | ARN of the created SNS topic for Slack |
2828

2929
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
30+
<!-- BEGIN_TF_DOCS -->
31+
## Requirements
32+
33+
No requirements.
34+
35+
## Providers
36+
37+
No providers.
38+
39+
## Modules
40+
41+
| Name | Source | Version |
42+
|------|--------|---------|
43+
| <a name="module_notify_slack"></a> [notify\_slack](#module\_notify\_slack) | ../../ | n/a |
44+
45+
## Resources
46+
47+
No resources.
48+
49+
## Inputs
50+
51+
No inputs.
52+
53+
## Outputs
54+
55+
| Name | Description |
56+
|------|-------------|
57+
| <a name="output_lambda_iam_role_arn"></a> [lambda\_iam\_role\_arn](#output\_lambda\_iam\_role\_arn) | The ARN of the IAM role used by Lambda function |
58+
| <a name="output_lambda_iam_role_name"></a> [lambda\_iam\_role\_name](#output\_lambda\_iam\_role\_name) | The name of the IAM role used by Lambda function |
59+
| <a name="output_notify_slack_lambda_function_arn"></a> [notify\_slack\_lambda\_function\_arn](#output\_notify\_slack\_lambda\_function\_arn) | The ARN of the Lambda function |
60+
| <a name="output_notify_slack_lambda_function_invoke_arn"></a> [notify\_slack\_lambda\_function\_invoke\_arn](#output\_notify\_slack\_lambda\_function\_invoke\_arn) | The ARN to be used for invoking Lambda function from API Gateway |
61+
| <a name="output_notify_slack_lambda_function_last_modified"></a> [notify\_slack\_lambda\_function\_last\_modified](#output\_notify\_slack\_lambda\_function\_last\_modified) | The date Lambda function was last modified |
62+
| <a name="output_notify_slack_lambda_function_name"></a> [notify\_slack\_lambda\_function\_name](#output\_notify\_slack\_lambda\_function\_name) | The name of the Lambda function |
63+
| <a name="output_notify_slack_lambda_function_version"></a> [notify\_slack\_lambda\_function\_version](#output\_notify\_slack\_lambda\_function\_version) | Latest published version of your Lambda function |
64+
| <a name="output_this_sns_topic_arn"></a> [this\_sns\_topic\_arn](#output\_this\_sns\_topic\_arn) | The ARN of the SNS topic from which messages will be sent to Slack |
65+
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)