support space inside source_port_range (#108)

* support space inside source_port_range
This commit is contained in:
lonegunmanb 2023-05-08 14:30:58 +08:00 коммит произвёл GitHub
Родитель 41db6d5435
Коммит 1dc82691db
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 17 добавлений и 4 удалений

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

@ -0,0 +1,13 @@
terraform {
required_version = ">=1.2"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.11.0, < 4.0"
}
}
}
provider "azurerm" {
features {}
}

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

@ -32,7 +32,7 @@ resource "azurerm_network_security_rule" "predefined_rules" {
source_address_prefixes = lookup(var.predefined_rules[count.index], "source_application_security_group_ids", null) == null ? var.source_address_prefixes : null
source_application_security_group_ids = lookup(var.predefined_rules[count.index], "source_application_security_group_ids", null)
source_port_range = lookup(var.predefined_rules[count.index], "source_port_range", "*") == "*" ? "*" : null
source_port_ranges = lookup(var.predefined_rules[count.index], "source_port_range", "*") == "*" ? null : split(",", var.predefined_rules[count.index].source_port_range)
source_port_ranges = lookup(var.predefined_rules[count.index], "source_port_range", "*") == "*" ? null : [for p in split(",", var.predefined_rules[count.index].source_port_range) : trimspace(p)]
}
resource "azurerm_network_security_rule" "predefined_rules_for" {
@ -54,7 +54,7 @@ resource "azurerm_network_security_rule" "predefined_rules_for" {
source_address_prefixes = lookup(each.value, "source_application_security_group_ids", null) == null ? var.source_address_prefixes : null
source_application_security_group_ids = lookup(each.value, "source_application_security_group_ids", null)
source_port_range = lookup(each.value, "source_port_range", "*") == "*" ? "*" : null
source_port_ranges = lookup(each.value, "source_port_range", "*") == "*" ? null : split(",", each.value.source_port_range)
source_port_ranges = lookup(each.value, "source_port_range", "*") == "*" ? null : [for r in split(",", each.value.source_port_range) : trimspace(r)]
lifecycle {
precondition {
@ -87,7 +87,7 @@ resource "azurerm_network_security_rule" "custom_rules" {
source_address_prefixes = lookup(var.custom_rules[count.index], "source_application_security_group_ids", null) == null ? lookup(var.custom_rules[count.index], "source_address_prefixes", null) : null
source_application_security_group_ids = lookup(var.custom_rules[count.index], "source_application_security_group_ids", null)
source_port_range = lookup(var.custom_rules[count.index], "source_port_range", "*") == "*" ? "*" : null
source_port_ranges = lookup(var.custom_rules[count.index], "source_port_range", "*") == "*" ? null : split(",", var.custom_rules[count.index].source_port_range)
source_port_ranges = lookup(var.custom_rules[count.index], "source_port_range", "*") == "*" ? null : [for r in split(",", var.custom_rules[count.index].source_port_range) : trimspace(r)]
lifecycle {
precondition {
@ -116,7 +116,7 @@ resource "azurerm_network_security_rule" "custom_rules_for" {
source_address_prefixes = lookup(each.value, "source_application_security_group_ids", null) == null ? lookup(each.value, "source_address_prefixes", null) : null
source_application_security_group_ids = lookup(each.value, "source_application_security_group_ids", null)
source_port_range = lookup(each.value, "source_port_range", "*") == "*" ? "*" : null
source_port_ranges = lookup(each.value, "source_port_range", "*") == "*" ? null : split(",", each.value.source_port_range)
source_port_ranges = lookup(each.value, "source_port_range", "*") == "*" ? null : [for r in split(",", each.value.source_port_range) : trimspace(r)]
lifecycle {
precondition {