Skip to content

Commit

Permalink
fix:change in count condition (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupalgw authored Feb 26, 2024
1 parent fdde9ac commit c389f4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ resource "azurerm_network_security_group" "nsg" {
## Below resource will create network security group inbound rules in azure and will be attached to above network security group.
##-----------------------------------------------------------------------------
resource "azurerm_network_security_rule" "inbound" {
for_each = { for rule in var.inbound_rules : rule.name => rule }
for_each = var.enabled ? { for rule in var.inbound_rules : rule.name => rule } : {}
resource_group_name = var.resource_group_name
network_security_group_name = azurerm_network_security_group.nsg[0].name
direction = "Inbound"
Expand Down Expand Up @@ -65,7 +65,7 @@ resource "azurerm_network_security_rule" "inbound" {
## Below resource will create network security group outbound rules in azure and will be attached to above network security group.
##-----------------------------------------------------------------------------
resource "azurerm_network_security_rule" "outbound" {
for_each = { for rule in var.outbound_rules : rule.name => rule }
for_each = var.enabled ? { for rule in var.outbound_rules : rule.name => rule } : {}
resource_group_name = var.resource_group_name
network_security_group_name = azurerm_network_security_group.nsg[0].name
direction = "Outbound"
Expand Down
6 changes: 3 additions & 3 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
output "id" {
value = azurerm_network_security_group.nsg[0].id
value = try(azurerm_network_security_group.nsg[0].id, null)
description = "The network security group configuration ID."
}

output "name" {
value = azurerm_network_security_group.nsg[0].name
value = try(azurerm_network_security_group.nsg[0].name, null)
description = "The name of the network security group."
}

Expand All @@ -14,7 +14,7 @@ output "tags" {
}

output "subnet_id" {
value = azurerm_subnet_network_security_group_association.example[0].subnet_id
value = try(azurerm_subnet_network_security_group_association.example[*].subnet_id, null)
description = "The ID of the Subnet. Changing this forces a new resource to be created."
}

Expand Down

0 comments on commit c389f4c

Please sign in to comment.