问题
Unable to provide destination_port_range for nsg security rule in azure using terraform. Terraform v0.12.28 provider.azurerm v2.18.0
security_rule {
name = "databricks-control-plane-inbound-rule"
priority = 110
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = 225557
}
Error: Failure sending request: StatusCode=400 -- Original Error:
Code="SecurityRuleInvalidPortRange" Message="Security rule has invalid Port range. Value provided: 225557. Value should be an integer OR integer range with '-' delimiter. Valid range 0-65535." Details=[]
回答1:
For your issue, you want to add multiple destination ports in one NSG rule. So you need to use the destination_port_ranges
instead of the destination_port_range
like this:
security_rule {
name = "databricks-control-plane-inbound-rule"
priority = 110
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_ranges = ["22", "5557"]
}
回答2:
The destination_port_range
in your security_rule is 225557
, which is not a valid port number because it has one digit too many. It should be a number between 0
and 65535
来源:https://stackoverflow.com/questions/63016875/security-rule-has-invalid-port-range-terraform