|
| 1 | +# Inbound rules |
| 2 | +resource "azurerm_network_security_rule" "port80" { |
| 3 | + name = "AllowHttpOn80" |
| 4 | + description = "port 80 open for HTTP traffic" |
| 5 | + priority = 150 |
| 6 | + direction = "Inbound" |
| 7 | + access = "Allow" |
| 8 | + protocol = "Tcp" |
| 9 | + source_port_range = "*" |
| 10 | + destination_port_range = "80" |
| 11 | + source_address_prefix = "Internet" |
| 12 | + destination_address_prefix = "VirtualNetwork" |
| 13 | + resource_group_name = azurerm_resource_group.rg.name |
| 14 | + network_security_group_name = azurerm_network_security_group.nsg.name |
| 15 | +} |
| 16 | + |
| 17 | +resource "azurerm_network_security_rule" "port22" { |
| 18 | + name = "AllowSSHOn22" |
| 19 | + priority = 160 |
| 20 | + description = "Ssh on port 22" |
| 21 | + direction = "Inbound" |
| 22 | + access = "Allow" |
| 23 | + protocol = "Tcp" |
| 24 | + source_port_range = "*" |
| 25 | + destination_port_range = "22" |
| 26 | + source_address_prefix = "*" |
| 27 | + destination_address_prefix = "VirtualNetwork" |
| 28 | + resource_group_name = azurerm_resource_group.rg.name |
| 29 | + network_security_group_name = azurerm_network_security_group.nsg.name |
| 30 | + depends_on = [azurerm_network_security_rule.port80] |
| 31 | +} |
| 32 | + |
| 33 | +resource "azurerm_network_security_rule" "port8080" { |
| 34 | + name = "AllowAnyCustom8080Inbound" |
| 35 | + priority = 170 |
| 36 | + description = "port 8080 opened for jenkins deployment as a docker container" |
| 37 | + direction = "Inbound" |
| 38 | + access = "Allow" |
| 39 | + protocol = "*" |
| 40 | + source_port_range = "*" |
| 41 | + destination_port_range = "8080" |
| 42 | + source_address_prefix = "*" |
| 43 | + destination_address_prefix = "VirtualNetwork" |
| 44 | + resource_group_name = azurerm_resource_group.rg.name |
| 45 | + network_security_group_name = azurerm_network_security_group.nsg.name |
| 46 | + depends_on = [azurerm_network_security_rule.port22, |
| 47 | + azurerm_network_security_rule.port80 |
| 48 | + ] |
| 49 | +} |
| 50 | + |
| 51 | +resource "azurerm_network_security_rule" "port4243" { |
| 52 | + name = "AllowAnyCustom4243Inbound" |
| 53 | + priority = 180 |
| 54 | + description = "TCP connection jenkins + docker set" |
| 55 | + direction = "Inbound" |
| 56 | + access = "Allow" |
| 57 | + protocol = "Tcp" |
| 58 | + source_port_range = "*" |
| 59 | + destination_port_range = "4243" |
| 60 | + source_address_prefix = "*" |
| 61 | + destination_address_prefix = "VirtualNetwork" |
| 62 | + resource_group_name = azurerm_resource_group.rg.name |
| 63 | + network_security_group_name = azurerm_network_security_group.nsg.name |
| 64 | + depends_on = [azurerm_network_security_rule.port22, |
| 65 | + azurerm_network_security_rule.port80, azurerm_network_security_rule.port8080 |
| 66 | + ] |
| 67 | +} |
0 commit comments