Skip to content

Commit

Permalink
feat: Shorten outputs (removing this_) (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbabenko committed Apr 26, 2021
1 parent 984eb7c commit 076d704
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.48.0
rev: v1.50.0
hooks:
- id: terraform_fmt
- id: terraform_validate
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,15 @@ No modules.
| <a name="output_http_tcp_listener_ids"></a> [http\_tcp\_listener\_ids](#output\_http\_tcp\_listener\_ids) | The IDs of the TCP and HTTP load balancer listeners created. |
| <a name="output_https_listener_arns"></a> [https\_listener\_arns](#output\_https\_listener\_arns) | The ARNs of the HTTPS load balancer listeners created. |
| <a name="output_https_listener_ids"></a> [https\_listener\_ids](#output\_https\_listener\_ids) | The IDs of the load balancer listeners created. |
| <a name="output_lb_arn"></a> [lb\_arn](#output\_lb\_arn) | The ID and ARN of the load balancer we created. |
| <a name="output_lb_arn_suffix"></a> [lb\_arn\_suffix](#output\_lb\_arn\_suffix) | ARN suffix of our load balancer - can be used with CloudWatch. |
| <a name="output_lb_dns_name"></a> [lb\_dns\_name](#output\_lb\_dns\_name) | The DNS name of the load balancer. |
| <a name="output_lb_id"></a> [lb\_id](#output\_lb\_id) | The ID and ARN of the load balancer we created. |
| <a name="output_lb_zone_id"></a> [lb\_zone\_id](#output\_lb\_zone\_id) | The zone\_id of the load balancer to assist with creating DNS records. |
| <a name="output_target_group_arn_suffixes"></a> [target\_group\_arn\_suffixes](#output\_target\_group\_arn\_suffixes) | ARN suffixes of our target groups - can be used with CloudWatch. |
| <a name="output_target_group_arns"></a> [target\_group\_arns](#output\_target\_group\_arns) | ARNs of the target groups. Useful for passing to your Auto Scaling group. |
| <a name="output_target_group_attachments"></a> [target\_group\_attachments](#output\_target\_group\_attachments) | ARNs of the target group attachment IDs. |
| <a name="output_target_group_names"></a> [target\_group\_names](#output\_target\_group\_names) | Name of the target group. Useful for passing to your CodeDeploy Deployment Group. |
| <a name="output_this_lb_arn"></a> [this\_lb\_arn](#output\_this\_lb\_arn) | The ID and ARN of the load balancer we created. |
| <a name="output_this_lb_arn_suffix"></a> [this\_lb\_arn\_suffix](#output\_this\_lb\_arn\_suffix) | ARN suffix of our load balancer - can be used with CloudWatch. |
| <a name="output_this_lb_dns_name"></a> [this\_lb\_dns\_name](#output\_this\_lb\_dns\_name) | The DNS name of the load balancer. |
| <a name="output_this_lb_id"></a> [this\_lb\_id](#output\_this\_lb\_id) | The ID and ARN of the load balancer we created. |
| <a name="output_this_lb_zone_id"></a> [this\_lb\_zone\_id](#output\_this\_lb\_zone\_id) | The zone\_id of the load balancer to assist with creating DNS records. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Authors
Expand Down
14 changes: 7 additions & 7 deletions examples/complete-alb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Source | Version |
|------|--------|---------|
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 2.0 |
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | |
| <a name="module_alb"></a> [alb](#module\_alb) | ../../ | |
| <a name="module_lambda_function"></a> [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 1.0 |
| <a name="module_lambda_function"></a> [lambda\_function](#module\_lambda\_function) | terraform-aws-modules/lambda/aws | ~> 2.0 |
| <a name="module_lb_disabled"></a> [lb\_disabled](#module\_lb\_disabled) | ../../ | |
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | terraform-aws-modules/security-group/aws | ~> 3.0 |

Expand Down Expand Up @@ -69,13 +69,13 @@ No inputs.
| <a name="output_http_tcp_listener_ids"></a> [http\_tcp\_listener\_ids](#output\_http\_tcp\_listener\_ids) | The IDs of the TCP and HTTP load balancer listeners created. |
| <a name="output_https_listener_arns"></a> [https\_listener\_arns](#output\_https\_listener\_arns) | The ARNs of the HTTPS load balancer listeners created. |
| <a name="output_https_listener_ids"></a> [https\_listener\_ids](#output\_https\_listener\_ids) | The IDs of the load balancer listeners created. |
| <a name="output_lb_arn"></a> [lb\_arn](#output\_lb\_arn) | The ID and ARN of the load balancer we created. |
| <a name="output_lb_arn_suffix"></a> [lb\_arn\_suffix](#output\_lb\_arn\_suffix) | ARN suffix of our load balancer - can be used with CloudWatch. |
| <a name="output_lb_dns_name"></a> [lb\_dns\_name](#output\_lb\_dns\_name) | The DNS name of the load balancer. |
| <a name="output_lb_id"></a> [lb\_id](#output\_lb\_id) | The ID and ARN of the load balancer we created. |
| <a name="output_lb_zone_id"></a> [lb\_zone\_id](#output\_lb\_zone\_id) | The zone\_id of the load balancer to assist with creating DNS records. |
| <a name="output_target_group_arn_suffixes"></a> [target\_group\_arn\_suffixes](#output\_target\_group\_arn\_suffixes) | ARN suffixes of our target groups - can be used with CloudWatch. |
| <a name="output_target_group_arns"></a> [target\_group\_arns](#output\_target\_group\_arns) | ARNs of the target groups. Useful for passing to your Auto Scaling group. |
| <a name="output_target_group_attachments"></a> [target\_group\_attachments](#output\_target\_group\_attachments) | ARNs of the target group attachment IDs. |
| <a name="output_target_group_names"></a> [target\_group\_names](#output\_target\_group\_names) | Name of the target group. Useful for passing to your CodeDeploy Deployment Group. |
| <a name="output_this_lb_arn"></a> [this\_lb\_arn](#output\_this\_lb\_arn) | The ID and ARN of the load balancer we created. |
| <a name="output_this_lb_arn_suffix"></a> [this\_lb\_arn\_suffix](#output\_this\_lb\_arn\_suffix) | ARN suffix of our load balancer - can be used with CloudWatch. |
| <a name="output_this_lb_dns_name"></a> [this\_lb\_dns\_name](#output\_this\_lb\_dns\_name) | The DNS name of the load balancer. |
| <a name="output_this_lb_id"></a> [this\_lb\_id](#output\_this\_lb\_id) | The ID and ARN of the load balancer we created. |
| <a name="output_this_lb_zone_id"></a> [this\_lb\_zone\_id](#output\_this\_lb\_zone\_id) | The zone\_id of the load balancer to assist with creating DNS records. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
15 changes: 7 additions & 8 deletions examples/complete-alb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ module "security_group" {
# }

module "acm" {
source = "terraform-aws-modules/acm/aws"
version = "~> 2.0"
source = "terraform-aws-modules/acm/aws"

domain_name = local.domain_name # trimsuffix(data.aws_route53_zone.this.name, ".") # Terraform >= 0.12.17
zone_id = data.aws_route53_zone.this.id
Expand Down Expand Up @@ -94,7 +93,7 @@ module "alb" {

# # See notes in README (ref: https://github.com/terraform-providers/terraform-provider-aws/issues/7987)
# access_logs = {
# bucket = module.log_bucket.this_s3_bucket_id
# bucket = module.log_bucket.s3_bucket_id
# }

http_tcp_listeners = [
Expand Down Expand Up @@ -131,7 +130,7 @@ module "alb" {
{
port = 443
protocol = "HTTPS"
certificate_arn = module.acm.this_acm_certificate_arn
certificate_arn = module.acm.acm_certificate_arn
target_group_index = 1
},
# Authentication actions only allowed with HTTPS
Expand All @@ -140,7 +139,7 @@ module "alb" {
protocol = "HTTPS"
action_type = "authenticate-cognito"
target_group_index = 1
certificate_arn = module.acm.this_acm_certificate_arn
certificate_arn = module.acm.acm_certificate_arn
authenticate_cognito = {
authentication_request_extra_params = {
display = "page"
Expand All @@ -159,7 +158,7 @@ module "alb" {
protocol = "HTTPS"
action_type = "authenticate-oidc"
target_group_index = 1
certificate_arn = module.acm.this_acm_certificate_arn
certificate_arn = module.acm.acm_certificate_arn
authenticate_oidc = {
authentication_request_extra_params = {
display = "page"
Expand Down Expand Up @@ -311,7 +310,7 @@ module "alb" {
# AccessDenied: elasticloadbalancing principal does not
# have permission to invoke ... from target group ...
my_lambda = {
target_id = module.lambda_function.this_lambda_function_arn
target_id = module.lambda_function.lambda_function_arn
}
}
},
Expand Down Expand Up @@ -390,7 +389,7 @@ resource "null_resource" "download_package" {

module "lambda_function" {
source = "terraform-aws-modules/lambda/aws"
version = "~> 1.0"
version = "~> 2.0"

function_name = "${random_pet.this.id}-lambda"
description = "My awesome lambda function"
Expand Down
20 changes: 10 additions & 10 deletions examples/complete-alb/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
output "this_lb_id" {
output "lb_id" {
description = "The ID and ARN of the load balancer we created."
value = module.alb.this_lb_id
value = module.alb.lb_id
}

output "this_lb_arn" {
output "lb_arn" {
description = "The ID and ARN of the load balancer we created."
value = module.alb.this_lb_arn
value = module.alb.lb_arn
}

output "this_lb_dns_name" {
output "lb_dns_name" {
description = "The DNS name of the load balancer."
value = module.alb.this_lb_dns_name
value = module.alb.lb_dns_name
}

output "this_lb_arn_suffix" {
output "lb_arn_suffix" {
description = "ARN suffix of our load balancer - can be used with CloudWatch."
value = module.alb.this_lb_arn_suffix
value = module.alb.lb_arn_suffix
}

output "this_lb_zone_id" {
output "lb_zone_id" {
description = "The zone_id of the load balancer to assist with creating DNS records."
value = module.alb.this_lb_zone_id
value = module.alb.lb_zone_id
}

output "http_tcp_listener_arns" {
Expand Down
12 changes: 6 additions & 6 deletions examples/complete-nlb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Source | Version |
|------|--------|---------|
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | ~> 2.0 |
| <a name="module_acm"></a> [acm](#module\_acm) | terraform-aws-modules/acm/aws | |
| <a name="module_nlb"></a> [nlb](#module\_nlb) | ../../ | |

## Resources
Expand All @@ -59,12 +59,12 @@ No inputs.
| <a name="output_http_tcp_listener_ids"></a> [http\_tcp\_listener\_ids](#output\_http\_tcp\_listener\_ids) | The IDs of the TCP and HTTP load balancer listeners created. |
| <a name="output_https_listener_arns"></a> [https\_listener\_arns](#output\_https\_listener\_arns) | The ARNs of the HTTPS load balancer listeners created. |
| <a name="output_https_listener_ids"></a> [https\_listener\_ids](#output\_https\_listener\_ids) | The IDs of the load balancer listeners created. |
| <a name="output_lb_arn"></a> [lb\_arn](#output\_lb\_arn) | The ID and ARN of the load balancer we created. |
| <a name="output_lb_arn_suffix"></a> [lb\_arn\_suffix](#output\_lb\_arn\_suffix) | ARN suffix of our load balancer - can be used with CloudWatch. |
| <a name="output_lb_dns_name"></a> [lb\_dns\_name](#output\_lb\_dns\_name) | The DNS name of the load balancer. |
| <a name="output_lb_id"></a> [lb\_id](#output\_lb\_id) | The ID and ARN of the load balancer we created. |
| <a name="output_lb_zone_id"></a> [lb\_zone\_id](#output\_lb\_zone\_id) | The zone\_id of the load balancer to assist with creating DNS records. |
| <a name="output_target_group_arn_suffixes"></a> [target\_group\_arn\_suffixes](#output\_target\_group\_arn\_suffixes) | ARN suffixes of our target groups - can be used with CloudWatch. |
| <a name="output_target_group_arns"></a> [target\_group\_arns](#output\_target\_group\_arns) | ARNs of the target groups. Useful for passing to your Auto Scaling group. |
| <a name="output_target_group_names"></a> [target\_group\_names](#output\_target\_group\_names) | Name of the target group. Useful for passing to your CodeDeploy Deployment Group. |
| <a name="output_this_lb_arn"></a> [this\_lb\_arn](#output\_this\_lb\_arn) | The ID and ARN of the load balancer we created. |
| <a name="output_this_lb_arn_suffix"></a> [this\_lb\_arn\_suffix](#output\_this\_lb\_arn\_suffix) | ARN suffix of our load balancer - can be used with CloudWatch. |
| <a name="output_this_lb_dns_name"></a> [this\_lb\_dns\_name](#output\_this\_lb\_dns\_name) | The DNS name of the load balancer. |
| <a name="output_this_lb_id"></a> [this\_lb\_id](#output\_this\_lb\_id) | The ID and ARN of the load balancer we created. |
| <a name="output_this_lb_zone_id"></a> [this\_lb\_zone\_id](#output\_this\_lb\_zone\_id) | The zone\_id of the load balancer to assist with creating DNS records. |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
8 changes: 3 additions & 5 deletions examples/complete-nlb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ data "aws_route53_zone" "this" {

# module "log_bucket" {
# source = "terraform-aws-modules/s3-bucket/aws"
# version = "~> 1.0"
#
# bucket = "logs-${random_pet.this.id}"
# acl = "log-delivery-write"
Expand All @@ -36,8 +35,7 @@ data "aws_route53_zone" "this" {
# }

module "acm" {
source = "terraform-aws-modules/acm/aws"
version = "~> 2.0"
source = "terraform-aws-modules/acm/aws"

domain_name = local.domain_name # trimsuffix(data.aws_route53_zone.this.name, ".") # Terraform >= 0.12.17
zone_id = data.aws_route53_zone.this.id
Expand Down Expand Up @@ -69,7 +67,7 @@ module "nlb" {

# # See notes in README (ref: https://github.com/terraform-providers/terraform-provider-aws/issues/7987)
# access_logs = {
# bucket = module.log_bucket.this_s3_bucket_id
# bucket = module.log_bucket.s3_bucket_id
# }


Expand Down Expand Up @@ -97,7 +95,7 @@ module "nlb" {
{
port = 84
protocol = "TLS"
certificate_arn = module.acm.this_acm_certificate_arn
certificate_arn = module.acm.acm_certificate_arn
target_group_index = 3
},
]
Expand Down
20 changes: 10 additions & 10 deletions examples/complete-nlb/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
output "this_lb_id" {
output "lb_id" {
description = "The ID and ARN of the load balancer we created."
value = module.nlb.this_lb_id
value = module.nlb.lb_id
}

output "this_lb_arn" {
output "lb_arn" {
description = "The ID and ARN of the load balancer we created."
value = module.nlb.this_lb_arn
value = module.nlb.lb_arn
}

output "this_lb_dns_name" {
output "lb_dns_name" {
description = "The DNS name of the load balancer."
value = module.nlb.this_lb_dns_name
value = module.nlb.lb_dns_name
}

output "this_lb_arn_suffix" {
output "lb_arn_suffix" {
description = "ARN suffix of our load balancer - can be used with CloudWatch."
value = module.nlb.this_lb_arn_suffix
value = module.nlb.lb_arn_suffix
}

output "this_lb_zone_id" {
output "lb_zone_id" {
description = "The zone_id of the load balancer to assist with creating DNS records."
value = module.nlb.this_lb_zone_id
value = module.nlb.lb_zone_id
}

output "http_tcp_listener_arns" {
Expand Down
10 changes: 5 additions & 5 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
output "this_lb_id" {
output "lb_id" {
description = "The ID and ARN of the load balancer we created."
value = concat(aws_lb.this.*.id, [""])[0]
}

output "this_lb_arn" {
output "lb_arn" {
description = "The ID and ARN of the load balancer we created."
value = concat(aws_lb.this.*.arn, [""])[0]
}

output "this_lb_dns_name" {
output "lb_dns_name" {
description = "The DNS name of the load balancer."
value = concat(aws_lb.this.*.dns_name, [""])[0]
}

output "this_lb_arn_suffix" {
output "lb_arn_suffix" {
description = "ARN suffix of our load balancer - can be used with CloudWatch."
value = concat(aws_lb.this.*.arn_suffix, [""])[0]
}

output "this_lb_zone_id" {
output "lb_zone_id" {
description = "The zone_id of the load balancer to assist with creating DNS records."
value = concat(aws_lb.this.*.zone_id, [""])[0]
}
Expand Down

0 comments on commit 076d704

Please sign in to comment.