From e5b69a06ed24d00b2d0c1f4b0bcc60ce4074bf1c Mon Sep 17 00:00:00 2001 From: Mike Carey Date: Tue, 20 Jul 2021 15:33:12 -0500 Subject: [PATCH 1/4] Disables outputs when create is false bug create_api_domain_name is true --- outputs.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/outputs.tf b/outputs.tf index 2885c32..8e4f542 100644 --- a/outputs.tf +++ b/outputs.tf @@ -67,12 +67,12 @@ output "apigatewayv2_domain_name_configuration" { output "apigatewayv2_domain_name_target_domain_name" { description = "The target domain name" - value = var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "target_domain_name", "") : "" + value = var.create && var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "target_domain_name", "") : "" } output "apigatewayv2_domain_name_hosted_zone_id" { description = "The Amazon Route 53 Hosted Zone ID of the endpoint" - value = var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "hosted_zone_id", "") : "" + value = var.create && var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "hosted_zone_id", "") : "" } # api mapping From 44d94a3837499fe030f2a077789c39943aea918a Mon Sep 17 00:00:00 2001 From: Mike Carey Date: Tue, 20 Jul 2021 16:07:10 -0500 Subject: [PATCH 2/4] ready to be squashed From ec2822b6856f7261251ff513ffc5a0c97f60a67a Mon Sep 17 00:00:00 2001 From: Mike Carey Date: Tue, 20 Jul 2021 19:22:48 -0500 Subject: [PATCH 3/4] ready to be squashed From 96ccd7618db97b918023ecbd3aeed91efe6ecb83 Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Thu, 16 Sep 2021 09:29:38 +0200 Subject: [PATCH 4/4] Simplified code a bit --- README.md | 2 +- outputs.tf | 4 ++-- versions.tf | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8c793a6..6994fa4 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ module "api_gateway" { | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12.26 | +| [terraform](#requirement\_terraform) | >= 0.13.1 | | [aws](#requirement\_aws) | >= 3.3.0 | ## Providers diff --git a/outputs.tf b/outputs.tf index 8e4f542..f2e9c13 100644 --- a/outputs.tf +++ b/outputs.tf @@ -67,12 +67,12 @@ output "apigatewayv2_domain_name_configuration" { output "apigatewayv2_domain_name_target_domain_name" { description = "The target domain name" - value = var.create && var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "target_domain_name", "") : "" + value = try(aws_apigatewayv2_domain_name.this[0].domain_name_configuration[0].target_domain_name, "") } output "apigatewayv2_domain_name_hosted_zone_id" { description = "The Amazon Route 53 Hosted Zone ID of the endpoint" - value = var.create && var.create_api_domain_name ? lookup(tomap(element(element(concat(aws_apigatewayv2_domain_name.this.*.domain_name_configuration, [""]), 0), 0)), "hosted_zone_id", "") : "" + value = try(aws_apigatewayv2_domain_name.this[0].domain_name_configuration[0].hosted_zone_id, "") } # api mapping diff --git a/versions.tf b/versions.tf index 19d1aed..5892b91 100644 --- a/versions.tf +++ b/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12.26" + required_version = ">= 0.13.1" required_providers { aws = ">= 3.3.0"