Skip to content

Commit 4a92801

Browse files
authored
chore: use validation.IsIPAddress directly (#577)
1 parent dc79799 commit 4a92801

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

scaleway/resource_instance_security_group.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,10 @@ func securityGroupRuleSchema() *schema.Resource {
412412
Description: "Computed port range for this rule (e.g: 1-1024, 22-22)",
413413
},
414414
"ip": {
415-
Type: schema.TypeString,
416-
Optional: true,
417-
ValidateFunc: func(i interface{}, s string) ([]string, []error) {
418-
return validation.IsIPAddress(i, "server_ips")
419-
},
420-
Description: "Ip address for this rule (e.g: 1.1.1.1). Only one of ip or ip_range should be provided",
415+
Type: schema.TypeString,
416+
Optional: true,
417+
ValidateFunc: validation.IsIPAddress,
418+
Description: "Ip address for this rule (e.g: 1.1.1.1). Only one of ip or ip_range should be provided",
421419
},
422420
"ip_range": {
423421
Type: schema.TypeString,

scaleway/resource_lb_backend_beta.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ func resourceScalewayLbBackendBeta() *schema.Resource {
7272
"server_ips": {
7373
Type: schema.TypeList,
7474
Elem: &schema.Schema{
75-
Type: schema.TypeString,
76-
ValidateFunc: func(i interface{}, s string) ([]string, []error) {
77-
return validation.IsIPAddress(i, "server_ips")
78-
},
75+
Type: schema.TypeString,
76+
ValidateFunc: validation.IsIPAddress,
7977
},
8078
Optional: true,
8179
Description: "Backend server IP addresses list (IPv4 or IPv6)",

0 commit comments

Comments
 (0)