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 committed Jan 27, 2021
1 parent 62eec9a commit b725f76
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,10 @@ 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,
Expand Down

0 comments on commit b725f76

Please # to comment.