File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ resource "azurerm_resource_group" "test" {
24
24
module "network-security-group" {
25
25
source = "Azure/network-security-group/azurerm"
26
26
resource_group_name = azurerm_resource_group.test.name
27
+ location = "EastUS" # Optional; if not provided, will use Resource Group location
27
28
security_group_name = "nsg"
28
29
source_address_prefix = ["10.0.3.0/24"]
29
30
predefined_rules = [
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ data "azurerm_resource_group" "nsg" {
4
4
5
5
resource "azurerm_network_security_group" "nsg" {
6
6
name = var. security_group_name
7
- location = data. azurerm_resource_group . nsg . location
7
+ location = var . location != " " ? var . location : data. azurerm_resource_group . nsg . location
8
8
resource_group_name = data. azurerm_resource_group . nsg . name
9
9
tags = var. tags
10
10
}
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ variable "tags" {
14
14
default = {}
15
15
}
16
16
17
+ variable "location" {
18
+ description = " Location (Azure Region) for the network security group."
19
+ # No default - if it's not specified, use the resource group location (see main.tf)
20
+ default = " "
21
+ }
22
+
17
23
# Security Rules definition
18
24
19
25
# Predefined rules
You can’t perform that action at this time.
0 commit comments