Skip to content

Commit b6802ce

Browse files
committed
Add terraform docs generation
1 parent a2ee235 commit b6802ce

4 files changed

Lines changed: 94 additions & 8 deletions

File tree

.githooks/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ if command_exists ./node_modules/.bin/prettier; then
3838
echo "$files" | xargs ./node_modules/.bin/prettier --ignore-unknown --write
3939
fi
4040

41+
if command_exists terraform-docs; then
42+
cd asset-account/terraform/stack-set
43+
terraform-docs markdown . --output-file README.md
44+
fi
45+
4146
# Add the modified/prettified files to staging
4247
echo "$files" | xargs git add
4348

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@ jobs:
4747
- run: terraform validate
4848
working-directory: ${{ matrix.project }}
4949

50+
terraform-docs:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- run: |
56+
curl https://github.com/terraform-docs/terraform-docs/releases/download/v0.19.0/terraform-docs-v0.19.0-linux-amd64.tar.gz \
57+
--location
58+
--retry 5 \
59+
--retry-all-errors \
60+
--show-error |
61+
tar -xz > ./terraform-docs
62+
63+
- run: chmod +x ./terraform-docs
64+
65+
- run: ./terraform-docs markdown . > README.md
66+
working-directory: asset-account/terraform/stack-set
67+
68+
- run: >-
69+
git diff --exit-code --color=always || ( echo "Terraform docs are
70+
out-of-date. See the diff above." && exit 1 )
71+
5072
prettier:
5173
runs-on: ubuntu-latest
5274
steps:

asset-account/terraform/stack-set/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,60 @@ module "elastio_asset_account" {
2121
// Provide input parameters
2222
}
2323
```
24+
25+
<!-- BEGIN_TF_DOCS -->
26+
## Requirements
27+
28+
| Name | Version |
29+
|------|---------|
30+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
31+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |
32+
33+
## Providers
34+
35+
| Name | Version |
36+
|------|---------|
37+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |
38+
39+
## Modules
40+
41+
No modules.
42+
43+
## Resources
44+
45+
| Name | Type |
46+
|------|------|
47+
| [aws_cloudformation_stack_instances.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances) | resource |
48+
| [aws_cloudformation_stack_set.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set) | resource |
49+
50+
## Inputs
51+
52+
| Name | Description | Type | Default | Required |
53+
|------|-------------|------|---------|:--------:|
54+
| <a name="input_accounts"></a> [accounts](#input\_accounts) | The IDs AWS accounts where you want to create stack instances.<br/><br/>Specify `accounts` only if you are using `SELF_MANAGED` permissions model.<br/>If you are using the `SERVICE_MANAGED` permissions model specify `deployment_targets` instead. | `list(string)` | `null` | no |
55+
| <a name="input_administration_role_arn"></a> [administration\_role\_arn](#input\_administration\_role\_arn) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#administration_role_arn-1) | `string` | `null` | no |
56+
| <a name="input_auto_deployment"></a> [auto\_deployment](#input\_auto\_deployment) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#auto_deployment-1) | <pre>object({<br/> enabled = optional(bool)<br/> retain_stacks_on_account_removal = optional(bool)<br/> })</pre> | `null` | no |
57+
| <a name="input_call_as"></a> [call\_as](#input\_call\_as) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#call_as-1) | `string` | `null` | no |
58+
| <a name="input_deployment_targets"></a> [deployment\_targets](#input\_deployment\_targets) | The AWS Organizations accounts for which to create stack instances.<br/><br/>Specify `deployment_targets` only if you are using `SERVICE_MANAGED` permissions model.<br/>If you are using the `SELF_MANAGED` permissions model specify `accounts` instead.<br/><br/>[Details](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#deployment_targets) | <pre>object({<br/> account_filter_type = optional(string)<br/> accounts = optional(list(string))<br/> accounts_url = optional(string)<br/> organizational_unit_ids = optional(list(string))<br/> })</pre> | `null` | no |
59+
| <a name="input_encrypt_with_cmk"></a> [encrypt\_with\_cmk](#input\_encrypt\_with\_cmk) | Provision an additional customer-managed KMS key to encrypt Lambda environment variables.<br/>This increases the cost of the stack. | `bool` | `false` | no |
60+
| <a name="input_execution_role_name"></a> [execution\_role\_name](#input\_execution\_role\_name) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#execution_role_name-1) | `string` | `null` | no |
61+
| <a name="input_iam_resource_names_prefix"></a> [iam\_resource\_names\_prefix](#input\_iam\_resource\_names\_prefix) | Add a custom prefix to names of all IAM resources deployed by this stack. | `string` | `""` | no |
62+
| <a name="input_iam_resource_names_suffix"></a> [iam\_resource\_names\_suffix](#input\_iam\_resource\_names\_suffix) | Add a custom prefix to names of all IAM resources deployed by this stack. | `string` | `""` | no |
63+
| <a name="input_lambda_tracing"></a> [lambda\_tracing](#input\_lambda\_tracing) | Enable AWS X-Ray tracing for Lambda functions.<br/>This increases the cost of the stack. | `bool` | `false` | no |
64+
| <a name="input_managed_execution"></a> [managed\_execution](#input\_managed\_execution) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#managed_execution-1) | <pre>object({<br/> active = optional(bool)<br/> })</pre> | `null` | no |
65+
| <a name="input_operation_preferences"></a> [operation\_preferences](#input\_operation\_preferences) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#operation_preferences) | <pre>object({<br/> concurrency_mode = optional(string)<br/> failure_tolerance_count = optional(number)<br/> failure_tolerance_percentage = optional(number)<br/> max_concurrent_count = optional(number)<br/> max_concurrent_percentage = optional(number)<br/><br/> # Region settings are not supported, because there must be at most one stack per account in a single region.<br/> })</pre> | `null` | no |
66+
| <a name="input_permission_model"></a> [permission\_model](#input\_permission\_model) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#permission_model-1) | `string` | `null` | no |
67+
| <a name="input_region"></a> [region](#input\_region) | The AWS region where the Elastio Asset Account stack instances will be deployed.<br/>It is just a single region because this stack is deployed only once per AWS account. | `string` | `"us-east-1"` | no |
68+
| <a name="input_retain_stacks"></a> [retain\_stacks](#input\_retain\_stacks) | [See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#retain_stacks-1) | `bool` | `null` | no |
69+
| <a name="input_stack_set_description"></a> [stack\_set\_description](#input\_stack\_set\_description) | n/a | `string` | `"Elastio Asset Account StackSet creates IAM roles to link the AWS accounts with\nthe Elastio Connector. This allows the Elastio Connector to scan the assets\navailable in the account where the Elastio Asset Account stack instances are\ndeployed.\n"` | no |
70+
| <a name="input_stack_set_name"></a> [stack\_set\_name](#input\_stack\_set\_name) | n/a | `string` | `"ElastioAssetAccount"` | no |
71+
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags to apply to all resources created by this stack. | `map(string)` | `{}` | no |
72+
| <a name="input_template_url"></a> [template\_url](#input\_template\_url) | The URL of the Elastio Asset Account CloudFormation template obtained from<br/>the Elastio Portal.<br/><br/>This parameter is sensitive, because anyone who knows this URL can deploy<br/>Elastio Account stack and linking it to your Elastio tenant. | `string` | n/a | yes |
73+
74+
## Outputs
75+
76+
| Name | Description |
77+
|------|-------------|
78+
| <a name="output_stack_instances"></a> [stack\_instances](#output\_stack\_instances) | The outputs of the aws\_cloudformation\_stack\_instances resource. |
79+
| <a name="output_stack_set"></a> [stack\_set](#output\_stack\_set) | The outputs of the aws\_cloudformation\_stack\_set resource. |
80+
<!-- END_TF_DOCS -->

asset-account/terraform/stack-set/variables.tf

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ variable "deployment_targets" {
3535
Specify `deployment_targets` only if you are using `SERVICE_MANAGED` permissions model.
3636
If you are using the `SELF_MANAGED` permissions model specify `accounts` instead.
3737
38-
Details: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#deployment_targets
38+
[Details](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#deployment_targets)
3939
DESCR
4040

4141
type = object({
@@ -71,6 +71,8 @@ variable "tags" {
7171
}
7272

7373
variable "auto_deployment" {
74+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#auto_deployment-1)"
75+
7476
type = object({
7577
enabled = optional(bool)
7678
retain_stacks_on_account_removal = optional(bool)
@@ -101,7 +103,7 @@ variable "stack_set_description" {
101103
##################################
102104

103105
variable "operation_preferences" {
104-
description = "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#operation_preferences"
106+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#operation_preferences)"
105107

106108
type = object({
107109
concurrency_mode = optional(string)
@@ -116,7 +118,7 @@ variable "operation_preferences" {
116118
}
117119

118120
variable "managed_execution" {
119-
description = "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#managed_execution-1"
121+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#managed_execution-1)"
120122

121123
type = object({
122124
active = optional(bool)
@@ -125,35 +127,35 @@ variable "managed_execution" {
125127
}
126128

127129
variable "administration_role_arn" {
128-
description = "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#administration_role_arn-1"
130+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#administration_role_arn-1)"
129131

130132
type = string
131133
default = null
132134
}
133135

134136
variable "execution_role_name" {
135-
description = "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#execution_role_name-1"
137+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#execution_role_name-1)"
136138

137139
type = string
138140
default = null
139141
}
140142

141143
variable "permission_model" {
142-
description = "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#permission_model-1"
144+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#permission_model-1)"
143145

144146
type = string
145147
default = null
146148
}
147149

148150
variable "call_as" {
149-
description = "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#call_as-1"
151+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_set#call_as-1)"
150152

151153
type = string
152154
default = null
153155
}
154156

155157
variable "retain_stacks" {
156-
description = "See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#retain_stacks-1"
158+
description = "[See docs here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudformation_stack_instances#retain_stacks-1)"
157159

158160
type = bool
159161
default = null

0 commit comments

Comments
 (0)