Skip to content

Commit

Permalink
Consider unknown values true-ish in RouterInterface CustomizeDi… (#5178)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored and rileykarson committed Dec 16, 2019
1 parent ed1e978 commit 9afcffe
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion google/resource_compute_router_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,15 @@ func routerInterfaceDiffOneOfCheck(d *schema.ResourceDiff, meta interface{}) err
_, ipOk := d.GetOk("ip_range")
_, vpnOk := d.GetOk("vpn_tunnel")
_, icOk := d.GetOk("interconnect_attachment")
if !(ipOk || vpnOk || icOk) {
// When unset, these values are all known. However, if the value is an
// interpolation to a resource that hasn't been created, the value is
// unknown and d.GetOk will return false. For each value, if that value is
// unknown, consider it true-ish.
if !((ipOk || !d.NewValueKnown("ip_range")) ||
(vpnOk || !d.NewValueKnown("vpn_tunnel")) ||
(icOk || !d.NewValueKnown("interconnect_attachment"))) {
return fmt.Errorf("Each interface requires one linked resource or an ip range, or both.")
}

return nil
}

0 comments on commit 9afcffe

Please sign in to comment.