Skip to content

Commit

Permalink
fix: Remove try function from outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
13archit committed Jul 26, 2024
1 parent c008d1f commit 260cef1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -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."
}

Expand Down

0 comments on commit 260cef1

Please sign in to comment.