From 260cef1ef74e191ed01baa057db9257f122f0652 Mon Sep 17 00:00:00 2001 From: Archit Chopra Date: Fri, 26 Jul 2024 21:25:53 +0530 Subject: [PATCH] fix: Remove try function from outputs --- outputs.tf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/outputs.tf b/outputs.tf index c7e35da..6482258 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,45 +1,45 @@ output "specific_subnet_name" { - value = try(azurerm_subnet.subnet[*].name, null) + value = var.specific_name_subnet ? azurerm_subnet.subnet[*].name : null description = "The name of the subnet." } output "specific_subnet_id" { - value = try(azurerm_subnet.subnet[*].id, null) + value = var.specific_name_subnet ? azurerm_subnet.subnet[*].id : null description = "The name of the subnet." } output "specific_subnet_address_prefixes" { - value = try(azurerm_subnet.subnet[*].address_prefixes, null) + value = var.specific_name_subnet ? azurerm_subnet.subnet[*].address_prefixes : null description = "The address prefixes for the subnet." } output "default_subnet_name" { - value = try(azurerm_subnet.subnet[*].name, null) + value = !var.specific_name_subnet ? azurerm_subnet.subnet[*].name : null description = "The name of the subnet." } output "default_subnet_id" { - value = try(azurerm_subnet.subnet[*].id, null) + value = !var.specific_name_subnet ? azurerm_subnet.subnet[*].id : null description = "The subnet ID." } output "default_subnet_address_prefixes" { - value = try(azurerm_subnet.subnet[*].address_prefixes, null) + value = !var.specific_name_subnet ? azurerm_subnet.subnet[*].address_prefixes : null description = "The address prefixes for the subnet." } output "nat_gateway_id" { - value = try(azurerm_nat_gateway.natgw[0].id, null) + value = var.create_nat_gateway ? azurerm_nat_gateway.natgw[0].id : null description = "The ID of the NAT Gateway." } output "public_ip_address" { - value = try(azurerm_public_ip.pip[0].ip_address, null) + value = var.create_nat_gateway ? azurerm_public_ip.pip[0].ip_address : null description = "The IP address value that was allocated." } output "public_ip_id" { - value = try(azurerm_public_ip.pip[0].id, null) + value = var.create_nat_gateway ? azurerm_public_ip.pip[0].id : null description = " The ID of this Public IP." }