Skip to content

Commit 836b72d

Browse files
committed
adding terraform-docs to auto generate documentation
1 parent 39d27f4 commit 836b72d

10 files changed

Lines changed: 488 additions & 6 deletions

File tree

terraform/.terraform.docs.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
formatter: "markdown table" # this is required
2+
version: ""
3+
4+
header-from: main.tf
5+
footer-from: ""
6+
7+
recursive:
8+
enabled: false
9+
path: modules
10+
11+
sections:
12+
hide: []
13+
show: []
14+
15+
content: |-
16+
# Overview
17+
This module declares all of the resources necessary to create AWS IAM related resources.
18+
19+
# Terraform Directory
20+
{{ .Header }}
21+
{{ .Modules }}
22+
{{ .Resources }}
23+
{{ .Inputs }}
24+
{{ .Outputs }}
25+
{{ .Providers }}
26+
{{ .Requirements }}
27+
{{ .Footer }}
28+
To automatically update this documentation, install terraform-docs on your local machine run the following:
29+
cd <directory of README location to update>
30+
terraform-docs -c .terraform.docs.yml .
31+
32+
# Directory Structure
33+
Terraform directory structure
34+
35+
- 📁 [terraform](https://github.com/hackforla/ops-security/tree/cb/example/terraform)
36+
- 📁 [aws-custom-policies](https://github.com/hackforla/ops-security/tree/cb/example/terraform/aws-custom-policies) - JSON configurations for customer-managed policies (AWS-managed policies are referenced by ARN and not needed here)
37+
- 📁 [existing-policies](https://github.com/hackforla/ops-security/tree/cb/example/terraform/aws-custom-policies/existing-policies) - a few of our current policy configurations for reference
38+
- 📁 [modules](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules) - reusable Terraform configurations
39+
- 📄 [aws-custom-policies.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-groups) - maintain custom policies here
40+
- 📄 [aws-groups.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-groups) - maintain groups here
41+
- 📄 [aws-users.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-users) - maintain users here
42+
43+
output:
44+
file: README.md
45+
mode: replace
46+
template: |-
47+
<!-- BEGIN_TF_DOCS -->
48+
{{ .Content }}
49+
<!-- END_TF_DOCS -->
50+
51+
output-values:
52+
enabled: false
53+
from: ""
54+
55+
sort:
56+
enabled: true
57+
by: name
58+
59+
settings:
60+
anchor: true
61+
color: true
62+
default: true
63+
description: false
64+
escape: true
65+
hide-empty: true
66+
html: true
67+
indent: 2
68+
lockfile: true
69+
read-comments: true
70+
required: true
71+
sensitive: true
72+
type: true

terraform/README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
# Overview
3+
This module declares all of the resources necessary to create AWS IAM related resources.
4+
5+
# Terraform Directory
6+
7+
## Modules
8+
9+
| Name | Source | Version |
10+
|------|--------|---------|
11+
| <a name="module_iam_read_only_group"></a> [iam\_read\_only\_group](#module\_iam\_read\_only\_group) | ./modules/aws-groups | n/a |
12+
| <a name="module_iam_user_gwenstacy"></a> [iam\_user\_gwenstacy](#module\_iam\_user\_gwenstacy) | ./modules/aws-users | n/a |
13+
14+
15+
16+
17+
18+
19+
To automatically update this documentation, install terraform-docs on your local machine run the following:
20+
cd <directory of README location to update>
21+
terraform-docs -c .terraform.docs.yml .
22+
23+
# Directory Structure
124
Terraform directory structure
225

326
- 📁 [terraform](https://github.com/hackforla/ops-security/tree/cb/example/terraform)
4-
- 📁 [aws-custom-policies](https://github.com/hackforla/ops-security/tree/cb/example/terraform/aws-custom-policies) - JSON configurations for customer-managed policies (AWS-managed policies are referenced by ARN and not needed here)
5-
- 📁 [existing-policies](https://github.com/hackforla/ops-security/tree/cb/example/terraform/aws-custom-policies/existing-policies) - a few of our current policy configurations for reference
6-
- 📁 [modules](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules) - reusable Terraform configurations
7-
- 📄 [aws-custom-policies.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-groups) - maintain custom policies here
8-
- 📄 [aws-groups.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-groups) - maintain groups here
9-
- 📄 [aws-users.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-users) - maintain users here
27+
- 📁 [aws-custom-policies](https://github.com/hackforla/ops-security/tree/cb/example/terraform/aws-custom-policies) - JSON configurations for customer-managed policies (AWS-managed policies are referenced by ARN and not needed here)
28+
- 📁 [existing-policies](https://github.com/hackforla/ops-security/tree/cb/example/terraform/aws-custom-policies/existing-policies) - a few of our current policy configurations for reference
29+
- 📁 [modules](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules) - reusable Terraform configurations
30+
- 📄 [aws-custom-policies.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-groups) - maintain custom policies here
31+
- 📄 [aws-groups.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-groups) - maintain groups here
32+
- 📄 [aws-users.tf](https://github.com/hackforla/ops-security/tree/cb/example/terraform/modules/aws-users) - maintain users here
33+
34+
<!-- END_TF_DOCS -->
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
formatter: "markdown table" # this is required
2+
version: ""
3+
4+
header-from: main.tf
5+
footer-from: ""
6+
7+
recursive:
8+
enabled: false
9+
path: modules
10+
11+
sections:
12+
hide: []
13+
show: []
14+
15+
content: |-
16+
# Groups
17+
18+
This module declares all of the resources necessary to create AWS IAM groups.
19+
20+
{{ .Header }}
21+
{{ .Modules }}
22+
{{ .Resources }}
23+
{{ .Inputs }}
24+
{{ .Outputs }}
25+
{{ .Providers }}
26+
{{ .Requirements }}
27+
{{ .Footer }}
28+
To automatically update this documentation, install terraform-docs on your local machine run the following:
29+
cd <directory of README location to update>
30+
terraform-docs -c .terraform.docs.yml .
31+
output:
32+
file: README.md
33+
mode: replace
34+
template: |-
35+
<!-- BEGIN_TF_DOCS -->
36+
{{ .Content }}
37+
<!-- END_TF_DOCS -->
38+
39+
output-values:
40+
enabled: false
41+
from: ""
42+
43+
sort:
44+
enabled: true
45+
by: name
46+
47+
settings:
48+
anchor: true
49+
color: true
50+
default: true
51+
description: false
52+
escape: true
53+
hide-empty: true
54+
html: true
55+
indent: 2
56+
lockfile: true
57+
read-comments: true
58+
required: true
59+
sensitive: true
60+
type: true
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
# Groups
3+
4+
This module declares all of the resources necessary to create AWS IAM groups.
5+
6+
7+
8+
## Resources
9+
10+
| Name | Type |
11+
|------|------|
12+
| [aws_iam_group.group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_group) | resource |
13+
| [aws_iam_group_policy_attachment.group_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_group_policy_attachment) | resource |
14+
## Inputs
15+
16+
| Name | Description | Type | Default | Required |
17+
|------|-------------|------|---------|:--------:|
18+
| <a name="input_group_name"></a> [group\_name](#input\_group\_name) | The name of the IAM group | `string` | n/a | yes |
19+
| <a name="input_group_path"></a> [group\_path](#input\_group\_path) | Path in which to create the group | `string` | `"/"` | no |
20+
| <a name="input_policy_arn"></a> [policy\_arn](#input\_policy\_arn) | List of policy ARNs to attach to the group | `list(string)` | n/a | yes |
21+
## Outputs
22+
23+
| Name | Description |
24+
|------|-------------|
25+
| <a name="output_group_arn"></a> [group\_arn](#output\_group\_arn) | The ARN of the IAM group |
26+
| <a name="output_group_name"></a> [group\_name](#output\_group\_name) | The name of the IAM group |
27+
## Providers
28+
29+
| Name | Version |
30+
|------|---------|
31+
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
32+
33+
34+
To automatically update this documentation, install terraform-docs on your local machine run the following:
35+
cd <directory of README location to update>
36+
terraform-docs -c .terraform.docs.yml .
37+
<!-- END_TF_DOCS -->
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
formatter: "markdown table" # this is required
2+
version: ""
3+
4+
header-from: main.tf
5+
footer-from: ""
6+
7+
recursive:
8+
enabled: false
9+
path: modules
10+
11+
sections:
12+
hide: []
13+
show: []
14+
15+
content: |-
16+
# Policies
17+
18+
This module declares all of the resources necessary to create AWS IAM policies.
19+
20+
{{ .Header }}
21+
{{ .Modules }}
22+
{{ .Resources }}
23+
{{ .Inputs }}
24+
{{ .Outputs }}
25+
{{ .Providers }}
26+
{{ .Requirements }}
27+
{{ .Footer }}
28+
To automatically update this documentation, install terraform-docs on your local machine run the following:
29+
cd <directory of README location to update>
30+
terraform-docs -c .terraform.docs.yml .
31+
output:
32+
file: README.md
33+
mode: replace
34+
template: |-
35+
<!-- BEGIN_TF_DOCS -->
36+
{{ .Content }}
37+
<!-- END_TF_DOCS -->
38+
39+
output-values:
40+
enabled: false
41+
from: ""
42+
43+
sort:
44+
enabled: true
45+
by: name
46+
47+
settings:
48+
anchor: true
49+
color: true
50+
default: true
51+
description: false
52+
escape: true
53+
hide-empty: true
54+
html: true
55+
indent: 2
56+
lockfile: true
57+
read-comments: true
58+
required: true
59+
sensitive: true
60+
type: true
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
# Policies
3+
4+
This module declares all of the resources necessary to create AWS IAM policies.
5+
6+
7+
8+
## Resources
9+
10+
| Name | Type |
11+
|------|------|
12+
| [aws_iam_policy.custom_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
13+
## Inputs
14+
15+
| Name | Description | Type | Default | Required |
16+
|------|-------------|------|---------|:--------:|
17+
| <a name="input_policies"></a> [policies](#input\_policies) | Map of policy definitions | <pre>map(object({<br> description = string<br> filename = string<br> }))</pre> | n/a | yes |
18+
## Outputs
19+
20+
| Name | Description |
21+
|------|-------------|
22+
| <a name="output_policy_arns"></a> [policy\_arns](#output\_policy\_arns) | Map of policy names to their ARNs |
23+
## Providers
24+
25+
| Name | Version |
26+
|------|---------|
27+
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
28+
29+
30+
To automatically update this documentation, install terraform-docs on your local machine run the following:
31+
cd <directory of README location to update>
32+
terraform-docs -c .terraform.docs.yml .
33+
<!-- END_TF_DOCS -->
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
formatter: "markdown table" # this is required
2+
version: ""
3+
4+
header-from: main.tf
5+
footer-from: ""
6+
7+
recursive:
8+
enabled: false
9+
path: modules
10+
11+
sections:
12+
hide: []
13+
show: []
14+
15+
content: |-
16+
# Roles
17+
18+
This module declares all of the resources necessary to create AWS IAM roles.
19+
20+
{{ .Header }}
21+
{{ .Modules }}
22+
{{ .Resources }}
23+
{{ .Inputs }}
24+
{{ .Outputs }}
25+
{{ .Providers }}
26+
{{ .Requirements }}
27+
{{ .Footer }}
28+
To automatically update this documentation, install terraform-docs on your local machine run the following:
29+
cd <directory of README location to update>
30+
terraform-docs -c .terraform.docs.yml .
31+
output:
32+
file: README.md
33+
mode: replace
34+
template: |-
35+
<!-- BEGIN_TF_DOCS -->
36+
{{ .Content }}
37+
<!-- END_TF_DOCS -->
38+
39+
output-values:
40+
enabled: false
41+
from: ""
42+
43+
sort:
44+
enabled: true
45+
by: name
46+
47+
settings:
48+
anchor: true
49+
color: true
50+
default: true
51+
description: false
52+
escape: true
53+
hide-empty: true
54+
html: true
55+
indent: 2
56+
lockfile: true
57+
read-comments: true
58+
required: true
59+
sensitive: true
60+
type: true

0 commit comments

Comments
 (0)