From 9afcffe4da7c146e379e8f320dd6a34dd2b950bb Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 16 Dec 2019 10:24:41 -0800 Subject: [PATCH] =?UTF-8?q?Consider=20unknown=20values=20true-ish=20in=20R?= =?UTF-8?q?outerInterface=20CustomizeDi=E2=80=A6=20(#5178)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Modular Magician --- google/resource_compute_router_interface.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/google/resource_compute_router_interface.go b/google/resource_compute_router_interface.go index 7916e9c1c17..d7c82cc8bc2 100644 --- a/google/resource_compute_router_interface.go +++ b/google/resource_compute_router_interface.go @@ -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 }