Skip to content

Commit 885fa60

Browse files
authored
feat: Shorten outputs (removing this_) (#34)
1 parent aad54a3 commit 885fa60

File tree

10 files changed

+64
-68
lines changed

10 files changed

+64
-68
lines changed

.github/workflows/pre-commit.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@ on:
77
- master
88

99
jobs:
10-
# Min Terraform version(s)
10+
# Min Terraform version(s)
1111
getDirectories:
12-
name: Get root directories
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout
16-
uses: actions/checkout@v2
17-
- name: Install Python
18-
uses: actions/setup-python@v2
19-
- name: Build matrix
20-
id: matrix
21-
run: |
22-
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))")
23-
echo "::set-output name=directories::$DIRS"
24-
outputs:
25-
directories: ${{ steps.matrix.outputs.directories }}
12+
name: Get root directories
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Install Python
18+
uses: actions/setup-python@v2
19+
- name: Build matrix
20+
id: matrix
21+
run: |
22+
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))")
23+
echo "::set-output name=directories::$DIRS"
24+
outputs:
25+
directories: ${{ steps.matrix.outputs.directories }}
2626

2727
preCommitMinVersions:
2828
name: Min TF validate
2929
needs: getDirectories
3030
runs-on: ubuntu-latest
3131
strategy:
32-
matrix:
33-
directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}
32+
matrix:
33+
directory: ${{ fromJson(needs.getDirectories.outputs.directories) }}
3434
steps:
3535
- name: Checkout
3636
uses: actions/checkout@v2
@@ -59,7 +59,7 @@ jobs:
5959
pre-commit run terraform_validate --color=always --show-diff-on-failure --files $(ls *.tf)
6060

6161

62-
# Max Terraform version
62+
# Max Terraform version
6363
getBaseVersion:
6464
name: Module max TF version
6565
runs-on: ubuntu-latest
@@ -94,7 +94,7 @@ jobs:
9494
- name: Install pre-commit dependencies
9595
run: |
9696
pip install pre-commit
97-
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12.0-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
97+
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12\..+?-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
9898
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
9999
- name: Execute pre-commit
100100
# Run all pre-commit checks on max version supported

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.48.0
3+
rev: v1.50.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_validate

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
Terraform module to create a DynamoDB table.
44

5-
This type of resources supported:
6-
7-
* [DynamoDB table](https://www.terraform.io/docs/providers/aws/r/dynamodb_table.html)
8-
95
## Terraform versions
106

117
Terraform 0.12 or newer is supported.
@@ -108,10 +104,10 @@ No modules.
108104

109105
| Name | Description |
110106
|------|-------------|
111-
| <a name="output_this_dynamodb_table_arn"></a> [this\_dynamodb\_table\_arn](#output\_this\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
112-
| <a name="output_this_dynamodb_table_id"></a> [this\_dynamodb\_table\_id](#output\_this\_dynamodb\_table\_id) | ID of the DynamoDB table |
113-
| <a name="output_this_dynamodb_table_stream_arn"></a> [this\_dynamodb\_table\_stream\_arn](#output\_this\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
114-
| <a name="output_this_dynamodb_table_stream_label"></a> [this\_dynamodb\_table\_stream\_label](#output\_this\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
107+
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
108+
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
109+
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
110+
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
115111
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
116112

117113
## Authors

examples/autoscaling/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ No inputs.
5050

5151
| Name | Description |
5252
|------|-------------|
53-
| <a name="output_this_dynamodb_table_arn"></a> [this\_dynamodb\_table\_arn](#output\_this\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
54-
| <a name="output_this_dynamodb_table_id"></a> [this\_dynamodb\_table\_id](#output\_this\_dynamodb\_table\_id) | ID of the DynamoDB table |
55-
| <a name="output_this_dynamodb_table_stream_arn"></a> [this\_dynamodb\_table\_stream\_arn](#output\_this\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
56-
| <a name="output_this_dynamodb_table_stream_label"></a> [this\_dynamodb\_table\_stream\_label](#output\_this\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
53+
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
54+
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
55+
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
56+
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
5757
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/autoscaling/outputs.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
output "this_dynamodb_table_arn" {
1+
output "dynamodb_table_arn" {
22
description = "ARN of the DynamoDB table"
3-
value = module.dynamodb_table.this_dynamodb_table_arn
3+
value = module.dynamodb_table.dynamodb_table_arn
44
}
55

6-
output "this_dynamodb_table_id" {
6+
output "dynamodb_table_id" {
77
description = "ID of the DynamoDB table"
8-
value = module.dynamodb_table.this_dynamodb_table_id
8+
value = module.dynamodb_table.dynamodb_table_id
99
}
1010

11-
output "this_dynamodb_table_stream_arn" {
11+
output "dynamodb_table_stream_arn" {
1212
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
13-
value = module.dynamodb_table.this_dynamodb_table_stream_arn
13+
value = module.dynamodb_table.dynamodb_table_stream_arn
1414
}
1515

16-
output "this_dynamodb_table_stream_label" {
16+
output "dynamodb_table_stream_label" {
1717
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
18-
value = module.dynamodb_table.this_dynamodb_table_stream_label
18+
value = module.dynamodb_table.dynamodb_table_stream_label
1919
}

examples/basic/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ No inputs.
5050

5151
| Name | Description |
5252
|------|-------------|
53-
| <a name="output_this_dynamodb_table_arn"></a> [this\_dynamodb\_table\_arn](#output\_this\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
54-
| <a name="output_this_dynamodb_table_id"></a> [this\_dynamodb\_table\_id](#output\_this\_dynamodb\_table\_id) | ID of the DynamoDB table |
55-
| <a name="output_this_dynamodb_table_stream_arn"></a> [this\_dynamodb\_table\_stream\_arn](#output\_this\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
56-
| <a name="output_this_dynamodb_table_stream_label"></a> [this\_dynamodb\_table\_stream\_label](#output\_this\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
53+
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
54+
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
55+
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
56+
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
5757
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/basic/outputs.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
output "this_dynamodb_table_arn" {
1+
output "dynamodb_table_arn" {
22
description = "ARN of the DynamoDB table"
3-
value = module.dynamodb_table.this_dynamodb_table_arn
3+
value = module.dynamodb_table.dynamodb_table_arn
44
}
55

6-
output "this_dynamodb_table_id" {
6+
output "dynamodb_table_id" {
77
description = "ID of the DynamoDB table"
8-
value = module.dynamodb_table.this_dynamodb_table_id
8+
value = module.dynamodb_table.dynamodb_table_id
99
}
1010

11-
output "this_dynamodb_table_stream_arn" {
11+
output "dynamodb_table_stream_arn" {
1212
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
13-
value = module.dynamodb_table.this_dynamodb_table_stream_arn
13+
value = module.dynamodb_table.dynamodb_table_stream_arn
1414
}
1515

16-
output "this_dynamodb_table_stream_label" {
16+
output "dynamodb_table_stream_label" {
1717
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
18-
value = module.dynamodb_table.this_dynamodb_table_stream_label
18+
value = module.dynamodb_table.dynamodb_table_stream_label
1919
}

examples/global-tables/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ No inputs.
4949

5050
| Name | Description |
5151
|------|-------------|
52-
| <a name="output_this_dynamodb_table_arn"></a> [this\_dynamodb\_table\_arn](#output\_this\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
53-
| <a name="output_this_dynamodb_table_id"></a> [this\_dynamodb\_table\_id](#output\_this\_dynamodb\_table\_id) | ID of the DynamoDB table |
54-
| <a name="output_this_dynamodb_table_stream_arn"></a> [this\_dynamodb\_table\_stream\_arn](#output\_this\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
55-
| <a name="output_this_dynamodb_table_stream_label"></a> [this\_dynamodb\_table\_stream\_label](#output\_this\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
52+
| <a name="output_dynamodb_table_arn"></a> [dynamodb\_table\_arn](#output\_dynamodb\_table\_arn) | ARN of the DynamoDB table |
53+
| <a name="output_dynamodb_table_id"></a> [dynamodb\_table\_id](#output\_dynamodb\_table\_id) | ID of the DynamoDB table |
54+
| <a name="output_dynamodb_table_stream_arn"></a> [dynamodb\_table\_stream\_arn](#output\_dynamodb\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true |
55+
| <a name="output_dynamodb_table_stream_label"></a> [dynamodb\_table\_stream\_label](#output\_dynamodb\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true |
5656
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/global-tables/outputs.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
output "this_dynamodb_table_arn" {
1+
output "dynamodb_table_arn" {
22
description = "ARN of the DynamoDB table"
3-
value = module.dynamodb_table.this_dynamodb_table_arn
3+
value = module.dynamodb_table.dynamodb_table_arn
44
}
55

6-
output "this_dynamodb_table_id" {
6+
output "dynamodb_table_id" {
77
description = "ID of the DynamoDB table"
8-
value = module.dynamodb_table.this_dynamodb_table_id
8+
value = module.dynamodb_table.dynamodb_table_id
99
}
1010

11-
output "this_dynamodb_table_stream_arn" {
11+
output "dynamodb_table_stream_arn" {
1212
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
13-
value = module.dynamodb_table.this_dynamodb_table_stream_arn
13+
value = module.dynamodb_table.dynamodb_table_stream_arn
1414
}
1515

16-
output "this_dynamodb_table_stream_label" {
16+
output "dynamodb_table_stream_label" {
1717
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
18-
value = module.dynamodb_table.this_dynamodb_table_stream_label
18+
value = module.dynamodb_table.dynamodb_table_stream_label
1919
}

outputs.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
output "this_dynamodb_table_arn" {
1+
output "dynamodb_table_arn" {
22
description = "ARN of the DynamoDB table"
33
value = element(concat(aws_dynamodb_table.this.*.arn, [""]), 0)
44
}
55

6-
output "this_dynamodb_table_id" {
6+
output "dynamodb_table_id" {
77
description = "ID of the DynamoDB table"
88
value = element(concat(aws_dynamodb_table.this.*.id, [""]), 0)
99
}
1010

11-
output "this_dynamodb_table_stream_arn" {
11+
output "dynamodb_table_stream_arn" {
1212
description = "The ARN of the Table Stream. Only available when var.stream_enabled is true"
1313
value = var.stream_enabled ? concat(aws_dynamodb_table.this.*.stream_arn, [""])[0] : null
1414
}
1515

16-
output "this_dynamodb_table_stream_label" {
16+
output "dynamodb_table_stream_label" {
1717
description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true"
1818
value = var.stream_enabled ? concat(aws_dynamodb_table.this.*.stream_label, [""])[0] : null
1919
}

0 commit comments

Comments
 (0)