diff --git a/vultr/resource_firewall_rule.go b/vultr/resource_firewall_rule.go index 7b7200fa..91327d2e 100644 --- a/vultr/resource_firewall_rule.go +++ b/vultr/resource_firewall_rule.go @@ -177,6 +177,9 @@ func splitFirewallRule(portRange string) (int, int, error) { return 0, 0, nil } ports := strings.Split(portRange, "-") + if len(strings.TrimSpace(ports[0])) == 0 { + return 0, 0, nil + } from, err := strconv.Atoi(strings.TrimSpace(ports[0])) if err != nil { return 0, 0, err diff --git a/vultr/resource_firewall_rule_test.go b/vultr/resource_firewall_rule_test.go index a48c0a48..69a74d70 100644 --- a/vultr/resource_firewall_rule_test.go +++ b/vultr/resource_firewall_rule_test.go @@ -27,7 +27,7 @@ func TestSplitFirewallRule(t *testing.T) { portRange: "-", from: 0, to: 0, - err: true, + err: false, }, { portRange: "22",