This commit is contained in:
Eugene Chuvyrov 2019-10-21 07:42:29 -07:00
Родитель 88181b93ae
Коммит 45a164fc0e
1 изменённых файлов: 18 добавлений и 18 удалений

Просмотреть файл

@ -1,22 +1,22 @@
resource "azurerm_network_security_group" "nsgsecureweb" {
name = "secureweb"
location = var.location
resource_group_name = var.rg
resource "azurerm_network_security_group" "nsgsecureweb" {
  name                = "secureweb"
  location            = var.location
  resource_group_name = var.rg
}
resource "azurerm_network_security_rule" "custom_rules" {
count = length(var.custom_rules)
name = lookup(var.custom_rules[count.index], "name", "default_rule_name")
priority = lookup(var.custom_rules[count.index], "priority")
direction = lookup(var.custom_rules[count.index], "direction", "Any")
access = lookup(var.custom_rules[count.index], "access", "Allow")
protocol = lookup(var.custom_rules[count.index], "protocol", "*")
source_port_ranges = lookup(var.custom_rules[count.index], "source_port_range", "0-65535" )
destination_port_ranges = lookup(var.custom_rules[count.index], "destination_port_range", "0-65535")
source_address_prefix = lookup(var.custom_rules[count.index], "source_address_prefix", "*")
destination_address_prefix = lookup(var.custom_rules[count.index], "destination_address_prefix", "*")
description = lookup(var.custom_rules[count.index], "description", "Security rule")
resource_group_name = azurerm_resource_group.nsg.name
network_security_group_name = azurerm_network_security_group.nsgsecureweb.name
resource "azurerm_network_security_rule" "custom_rules" {
  count                       = length(var.custom_rules)
  name                        = lookup(var.custom_rules[count.index], "name", "default_rule_name")
  priority                    = lookup(var.custom_rules[count.index], "priority")
  direction                   = lookup(var.custom_rules[count.index], "direction", "Any")
  access                      = lookup(var.custom_rules[count.index], "access", "Allow")
  protocol                    = lookup(var.custom_rules[count.index], "protocol", "*")
  source_port_ranges          = lookup(var.custom_rules[count.index], "source_port_range", ["0-65535"] )
  destination_port_range      = lookup(var.custom_rules[count.index], "destination_port_range", ["0-65535"] )
  source_address_prefix       = lookup(var.custom_rules[count.index], "source_address_prefix", "*")
  destination_address_prefix  = lookup(var.custom_rules[count.index], "destination_address_prefix", "*")
  description                 = lookup(var.custom_rules[count.index], "description", "Security rule")
  resource_group_name         = var.rg
  network_security_group_name = azurerm_network_security_group.nsgsecureweb.name
}