Exclusion of `network_id`, `vpc_id` and `zone_id`

pull/11306/head
sawanoboly 9 years ago
parent d054663fbf
commit 9684c8b0b6
No known key found for this signature in database
GPG Key ID: D73A2B3A29A535A3

@ -155,9 +155,19 @@ func verifyIPAddressParams(d *schema.ResourceData) error {
_, vpc := d.GetOk("vpc_id")
_, zone := d.GetOk("zone_id")
if (network && vpc) || (!network && !vpc && !zone) {
f := func(bs ...bool) int {
cnt := 0
for _, b := range bs {
if b {
cnt++
}
}
return cnt
}
if f(network, vpc, zone) >= 2 || (!network && !vpc && !zone) {
return fmt.Errorf(
"You must supply a value for either (so not both) the 'network_id' or 'vpc_id' parameter")
"You must supply one value for either (so not more than two) the 'network_id' or 'vpc_id' or 'zone_id' parameter")
}
return nil

Loading…
Cancel
Save