-
Notifications
You must be signed in to change notification settings - Fork 0
/
nsg.tf
48 lines (43 loc) · 1.79 KB
/
nsg.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
resource "azurerm_network_security_group" "cliff-nsg" {
name = "nsg"
location = azurerm_resource_group.cliff.location
resource_group_name = azurerm_resource_group.cliff.name
security_rule {
name = "allowWinRm"
priority = 101
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_ranges = ["5986"] # Winrm over HTTPS
source_address_prefix = var.cloud_shell_source
destination_address_prefix = "*" # Allow traffic to any destination
}
security_rule {
name = "allowWinRm2"
priority = 102
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_ranges = ["5986"] # Winrm over HTTPS
source_address_prefix = var.cloud_shell_source
destination_address_prefix = "*" # Allow traffic to any destination
}
security_rule {
name = "allowWinRm3"
priority = 103
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_ranges = ["5986"] # Winrm over HTTPS
source_address_prefix = var.cloud_shell_source
destination_address_prefix = "*" # Allow traffic to any destination
}
}
resource "azurerm_network_interface_security_group_association" "nsg" {
count = 2
network_interface_id = azurerm_network_interface.mars[count.index].id
network_security_group_id = azurerm_network_security_group.cliff-nsg.id
}