Skip to content

Commit 23a96e8

Browse files
antonbabenkomax-rocket-internet
authored andcommitted
Added pre-commit-terraform to update docs (#217)
* Added pre-commit-terraform to update docs * Updated .github/PULL_REQUEST_TEMPLATE.md
1 parent e6671e4 commit 23a96e8

File tree

4 files changed

+28
-133
lines changed

4 files changed

+28
-133
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ Please explain the changes you made here and link to any relevant issues.
99
- [ ] `terraform fmt` and `terraform validate` both work from the root and `examples/eks_test_fixture` directories (look in CI for an example)
1010
- [ ] Tests for the changes have been added and passing (for bug fixes/features)
1111
- [ ] Test results are pasted in this PR (in lieu of CI)
12-
- [ ] Docs have been updated using `terraform-docs` per `README.md` instructions
1312
- [ ] I've added my change to CHANGELOG.md
1413
- [ ] Any breaking changes are highlighted above

.pre-commit-config.yaml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
# See http://pre-commit.com for more information
2-
# See http://pre-commit.com/hooks.html for more hooks
31
repos:
4-
- repo: git://github.com/antonbabenko/pre-commit-terraform
5-
rev: v1.7.1
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
13-
- id: trailing-whitespace
14-
# - id: end-of-file-fixer
15-
- id: check-yaml
16-
- id: check-added-large-files
2+
- repo: git://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.7.4
4+
hooks:
5+
- id: terraform_fmt
6+
- id: terraform_docs
7+
- repo: git://github.com/pre-commit/pre-commit-hooks
8+
rev: v2.0.0
9+
hooks:
10+
- id: check-merge-conflict
11+
- id: trailing-whitespace
12+
- id: check-yaml
13+
- id: check-added-large-files

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,11 @@ kubectl get nodes --watch --kubeconfig kubeconfig
6565

6666
## Doc generation
6767

68-
Documentation should be modified within `main.tf` and generated using [terraform-docs](https://github.com/segmentio/terraform-docs).
68+
Code formatting and documentation for variables and outputs is generated using [pre-commit-terraform hooks](https://github.com/antonbabenko/pre-commit-terraform) which uses [terraform-docs](https://github.com/segmentio/terraform-docs).
6969

70-
Install it with `go get github.com/segmentio/terraform-docs` or `brew install terraform-docs` and then use it to generate the `README.md` file:
70+
Follow [these instructions](https://github.com/antonbabenko/pre-commit-terraform#how-to-install) to install pre-commit locally.
7171

72-
```
73-
terraform-docs --with-aggregate-type-defaults md ./ | sed -e '$ d' -e 'N;/^\n$/D;P;D' > README.md
74-
```
72+
And install `terraform-docs` with `go get github.com/segmentio/terraform-docs` or `brew install terraform-docs`.
7573

7674
## Contributing
7775

@@ -97,6 +95,7 @@ Many thanks to [the contributors listed here](https://github.com/terraform-aws-m
9795
9896
MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-aws-eks/tree/master/LICENSE) for full details.
9997
98+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
10099
## Inputs
101100
102101
| Name | Description | Type | Default | Required |
@@ -108,29 +107,29 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
108107
| cluster\_security\_group\_id | If provided, the EKS cluster will be attached to this security group. If not given, a security group will be created with necessary ingres/egress to work with the workers and provide API access to your current IP/32. | string | `` | no |
109108
| cluster\_version | Kubernetes version to use for the EKS cluster. | string | `1.10` | no |
110109
| config\_output\_path | Where to save the Kubectl config file (if `write_kubeconfig = true`). Should end in a forward slash `/` . | string | `./` | no |
111-
| kubeconfig\_aws\_authenticator\_additional\_args | Any additional arguments to pass to the authenticator such as the role to assume. e.g. ["-r", "MyEksRole"]. | list | `<list>` | no |
110+
| kubeconfig\_aws\_authenticator\_additional\_args | Any additional arguments to pass to the authenticator such as the role to assume. e.g. ["-r", "MyEksRole"]. | list | `[]` | no |
112111
| kubeconfig\_aws\_authenticator\_command | Command to use to to fetch AWS EKS credentials. | string | `aws-iam-authenticator` | no |
113-
| kubeconfig\_aws\_authenticator\_command\_args | Default arguments passed to the authenticator command. Defaults to [token -i $cluster_name]. | list | `<list>` | no |
114-
| kubeconfig\_aws\_authenticator\_env\_variables | Environment variables that should be used when executing the authenticator. e.g. { AWS_PROFILE = "eks"}. | map | `<map>` | no |
112+
| kubeconfig\_aws\_authenticator\_command\_args | Default arguments passed to the authenticator command. Defaults to [token -i $cluster_name]. | list | `[]` | no |
113+
| kubeconfig\_aws\_authenticator\_env\_variables | Environment variables that should be used when executing the authenticator. e.g. { AWS_PROFILE = "eks"}. | map | `{}` | no |
115114
| kubeconfig\_name | Override the default name used for items kubeconfig. | string | `` | no |
116-
| local\_exec\_interpreter | Command to run for local-exec resources. Must be a shell-style interpreter. If you are on Windows Git Bash is a good choice. | list | `<list>` | no |
115+
| local\_exec\_interpreter | Command to run for local-exec resources. Must be a shell-style interpreter. If you are on Windows Git Bash is a good choice. | list | `[ "/bin/sh", "-c" ]` | no |
117116
| manage\_aws\_auth | Whether to write and apply the aws-auth configmap file. | string | `true` | no |
118-
| map\_accounts | Additional AWS account numbers to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `<list>` | no |
117+
| map\_accounts | Additional AWS account numbers to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `[]` | no |
119118
| map\_accounts\_count | The count of accounts in the map_accounts list. | string | `0` | no |
120-
| map\_roles | Additional IAM roles to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `<list>` | no |
119+
| map\_roles | Additional IAM roles to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `[]` | no |
121120
| map\_roles\_count | The count of roles in the map_roles list. | string | `0` | no |
122-
| map\_users | Additional IAM users to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `<list>` | no |
121+
| map\_users | Additional IAM users to add to the aws-auth configmap. See examples/eks_test_fixture/variables.tf for example format. | list | `[]` | no |
123122
| map\_users\_count | The count of roles in the map_users list. | string | `0` | no |
124123
| subnets | A list of subnets to place the EKS cluster and workers within. | list | - | yes |
125-
| tags | A map of tags to add to all resources. | map | `<map>` | no |
124+
| tags | A map of tags to add to all resources. | map | `{}` | no |
126125
| vpc\_id | VPC where the cluster and workers will be deployed. | string | - | yes |
127-
| worker\_additional\_security\_group\_ids | A list of additional security group ids to attach to worker instances | list | `<list>` | no |
126+
| worker\_additional\_security\_group\_ids | A list of additional security group ids to attach to worker instances | list | `[]` | no |
128127
| worker\_create\_security\_group | Whether to create a security group for the workers or attach the workers to `worker_security_group_id`. | string | `true` | no |
129128
| worker\_group\_count | The number of maps contained within the worker_groups list. | string | `1` | no |
130-
| worker\_groups | A list of maps defining worker group configurations. See workers_group_defaults for valid keys. | list | `<list>` | no |
129+
| worker\_groups | A list of maps defining worker group configurations. See workers_group_defaults for valid keys. | list | `[ { "name": "default" } ]` | no |
131130
| worker\_security\_group\_id | If provided, all workers will be attached to this security group. If not given, a security group will be created with necessary ingres/egress to work with the EKS cluster. | string | `` | no |
132131
| worker\_sg\_ingress\_from\_port | Minimum port number from which pods will accept communication. Must be changed to a lower value if some pods in your cluster will expose a port lower than 1025 (e.g. 22, 80, or 443). | string | `1025` | no |
133-
| workers\_group\_defaults | Override default values for target groups. See workers_group_defaults_defaults in locals.tf for valid keys. | map | `<map>` | no |
132+
| workers\_group\_defaults | Override default values for target groups. See workers_group_defaults_defaults in locals.tf for valid keys. | map | `{}` | no |
134133
| write\_kubeconfig | Whether to write a Kubectl config file containing the cluster configuration. Saved to `config_output_path`. | string | `true` | no |
135134
136135
## Outputs
@@ -149,3 +148,4 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
149148
| worker\_security\_group\_id | Security group ID attached to the EKS workers. |
150149
| workers\_asg\_arns | IDs of the autoscaling groups containing workers. |
151150
| workers\_asg\_names | Names of the autoscaling groups containing workers. |
151+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

main.tf

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)