Skip to content

Commit 669f188

Browse files
antonbabenkobrandonjbjelland
authored andcommitted
Added pre-commit hook to autogenerate terraform-docs (#68)
1 parent 274329a commit 669f188

File tree

3 files changed

+87
-7
lines changed

3 files changed

+87
-7
lines changed

.pre-commit-config.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# See http://pre-commit.com for more information
22
# See http://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
sha: v0.9.2
6-
hooks:
4+
- repo: git://github.com/antonbabenko/pre-commit-terraform
5+
rev: v1.7.0
6+
hooks:
7+
- id: terraform_fmt
8+
- id: terraform_docs
9+
- repo: git://github.com/pre-commit/pre-commit-hooks
10+
rev: v1.2.3
11+
hooks:
12+
- id: check-merge-conflict
713
- id: trailing-whitespace
814
# - id: end-of-file-fixer
915
- id: check-yaml

README.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ but we inherit a few bonuses by moving to ALB like the ability to leverage WAF.
3737
exhaustive set of reasons. Alternatively, if using ALB with ECS look no further than
3838
the [Hashicorp example](https://github.com/terraform-providers/terraform-provider-aws/blob/master/examples/ecs-alb).
3939

40-
## Resources, inputs, outputs
41-
42-
[Resources](https://registry.terraform.io/modules/terraform-aws-modules/alb/aws?tab=resources), [inputs](https://registry.terraform.io/modules/terraform-aws-modules/alb/aws?tab=inputs), and [outputs](https://registry.terraform.io/modules/terraform-aws-modules/alb/aws?tab=outputs) documented in the terraform registry.
43-
4440
## Usage example
4541

4642
A full example leveraging other community modules is contained in the [examples/alb_test_fixture directory](https://github.com/terraform-aws-modules/terraform-aws-alb/tree/master/examples/alb_test_fixture). Here's the gist of using it via the Terraform registry:
@@ -64,6 +60,56 @@ module "alb" {
6460
}
6561
```
6662

63+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
64+
65+
## Inputs
66+
67+
| Name | Description | Type | Default | Required |
68+
|------|-------------|:----:|:-----:|:-----:|
69+
| enable_deletion_protection | If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer. Defaults to false. | string | `false` | no |
70+
| enable_http2 | Indicates whether HTTP/2 is enabled in application load balancers. | string | `true` | no |
71+
| extra_ssl_certs | A list of maps describing any extra SSL certificates to apply to the HTTPS listeners. Required key/values: certificate_arn, https_listener_index (the index of the listener within https_listeners which the cert applies toward). | list | `<list>` | no |
72+
| extra_ssl_certs_count | A manually provided count/length of the extra_ssl_certs list of maps since the list cannot be computed. | string | `0` | no |
73+
| http_tcp_listeners | A list of maps describing the HTTPS listeners for this ALB. Required key/values: port, protocol. Optional key/values: target_group_index (defaults to 0) | list | `<list>` | no |
74+
| http_tcp_listeners_count | A manually provided count/length of the http_tcp_listeners list of maps since the list cannot be computed. | string | `0` | no |
75+
| https_listeners | A list of maps describing the HTTPS listeners for this ALB. Required key/values: port, certificate_arn. Optional key/values: ssl_policy (defaults to ELBSecurityPolicy-2016-08), target_group_index (defaults to 0) | list | `<list>` | no |
76+
| https_listeners_count | A manually provided count/length of the https_listeners list of maps since the list cannot be computed. | string | `0` | no |
77+
| idle_timeout | The time in seconds that the connection is allowed to be idle. | string | `60` | no |
78+
| ip_address_type | The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack. | string | `ipv4` | no |
79+
| listener_ssl_policy_default | The security policy if using HTTPS externally on the load balancer. See: https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-security-policy-table.html | string | `ELBSecurityPolicy-2016-08` | no |
80+
| load_balancer_create_timeout | Timeout value when creating the ALB. | string | `10m` | no |
81+
| load_balancer_delete_timeout | Timeout value when deleting the ALB. | string | `10m` | no |
82+
| load_balancer_is_internal | Boolean determining if the load balancer is internal or externally facing. | string | `false` | no |
83+
| load_balancer_name | The resource name and Name tag of the load balancer. | string | - | yes |
84+
| load_balancer_update_timeout | Timeout value when updating the ALB. | string | `10m` | no |
85+
| log_bucket_name | S3 bucket (externally created) for storing load balancer access logs. | string | - | yes |
86+
| log_location_prefix | S3 prefix within the log_bucket_name under which logs are stored. | string | `` | no |
87+
| security_groups | The security groups to attach to the load balancer. e.g. ["sg-edcd9784","sg-edcd9785"] | list | - | yes |
88+
| subnets | A list of subnets to associate with the load balancer. e.g. ['subnet-1a2b3c4d','subnet-1a2b3c4e','subnet-1a2b3c4f'] | list | - | yes |
89+
| tags | A map of tags to add to all resources | string | `<map>` | no |
90+
| target_groups | A list of maps containing key/value pairs that define the target groups to be created. Order of these maps is important and the index of these are to be referenced in listener definitions. Required key/values: name, backend_protocol, backend_port. Optional key/values are in the target_groups_defaults variable. | list | `<list>` | no |
91+
| target_groups_count | A manually provided count/length of the target_groups list of maps since the list cannot be computed. | string | `0` | no |
92+
| target_groups_defaults | Default values for target groups as defined by the list of maps. | map | `<map>` | no |
93+
| vpc_id | VPC id where the load balancer and other resources will be deployed. | string | - | yes |
94+
95+
## Outputs
96+
97+
| Name | Description |
98+
|------|-------------|
99+
| dns_name | The DNS name of the load balancer. |
100+
| http_tcp_listener_arns | The ARN of the TCP and HTTP load balancer listeners created. |
101+
| http_tcp_listener_ids | The IDs of the TCP and HTTP load balancer listeners created. |
102+
| https_listener_arns | The ARNs of the HTTPS load balancer listeners created. |
103+
| https_listener_ids | The IDs of the load balancer listeners created. |
104+
| load_balancer_arn_suffix | ARN suffix of our load balancer - can be used with CloudWatch. |
105+
| load_balancer_id | The ID and ARN of the load balancer we created. |
106+
| load_balancer_zone_id | The zone_id of the load balancer to assist with creating DNS records. |
107+
| target_group_arn_suffixes | ARN suffixes of our target groups - can be used with CloudWatch. |
108+
| target_group_arns | ARNs of the target groups. Useful for passing to your Auto Scaling group. |
109+
| target_group_names | Name of the target group. Useful for passing to your CodeDeploy Deployment Group. |
110+
111+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
112+
67113
## Testing
68114

69115
This module has been packaged with [awspec](https://github.com/k1LoW/awspec) tests through [kitchen](https://kitchen.ci/) and [kitchen-terraform](https://newcontext-oss.github.io/kitchen-terraform/). To run them:

examples/alb_test_fixture/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,31 @@ The following IAM policy is the minimum needed to execute the module from the te
112112
]
113113
}
114114
```
115+
116+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
117+
118+
## Inputs
119+
120+
| Name | Description | Type | Default | Required |
121+
|------|-------------|:----:|:-----:|:-----:|
122+
| log_bucket_name | | string | `test-log-bucket` | no |
123+
| log_location_prefix | | string | `my-lb-logs` | no |
124+
| region | | string | `us-west-2` | no |
125+
126+
## Outputs
127+
128+
| Name | Description |
129+
|------|-------------|
130+
| account_id | |
131+
| alb_id | |
132+
| http_tcp_listener_arns | |
133+
| http_tcp_listeners_count | |
134+
| https_listener_arns | |
135+
| https_listeners_count | |
136+
| region | |
137+
| sg_id | |
138+
| target_group_arns | |
139+
| target_groups_count | |
140+
| vpc_id | |
141+
142+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

0 commit comments

Comments
 (0)