Skip to content

Commit

Permalink
Add validation for netmask length
Browse files Browse the repository at this point in the history
Ensures a network mask's length will never exceed 32 for IPv4 and 128
for IPv6.
  • Loading branch information
Kyriakos Oikonomakos authored and koikonom committed Jan 27, 2021
1 parent 62eec9a commit b2f6e3e
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,19 +230,21 @@ func VirtualMachineCustomizeSchema() map[string]*schema.Schema {
Description: "The IPv4 address assigned to this network adapter. If left blank, DHCP is used.",
},
"ipv4_netmask": {
Type: schema.TypeInt,
Optional: true,
Description: "The IPv4 CIDR netmask for the supplied IP address. Ignored if DHCP is selected.",
Type: schema.TypeInt,
Optional: true,
Description: "The IPv4 CIDR netmask for the supplied IP address. Ignored if DHCP is selected.",
ValidateFunc: validation.IntAtMost(32),
},
"ipv6_address": {
Type: schema.TypeString,
Optional: true,
Description: "The IPv6 address assigned to this network adapter. If left blank, default auto-configuration is used.",
},
"ipv6_netmask": {
Type: schema.TypeInt,
Optional: true,
Description: "The IPv6 CIDR netmask for the supplied IP address. Ignored if auto-configuration is selected.",
Type: schema.TypeInt,
Optional: true,
Description: "The IPv6 CIDR netmask for the supplied IP address. Ignored if auto-configuration is selected.",
ValidateFunc: validation.IntAtMost(128),
},
}},
},
Expand Down

0 comments on commit b2f6e3e

Please # to comment.