From 1cc5068b8c6c1fc375956bcf9a09abb2a9b57489 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 26 Jun 2015 21:22:08 -0700 Subject: [PATCH] provider/aws: nil protection against VPN connections [GH-2144] --- builtin/providers/aws/resource_vpn_connection_route.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin/providers/aws/resource_vpn_connection_route.go b/builtin/providers/aws/resource_vpn_connection_route.go index b7bd9bd8cd..062fa32b0e 100644 --- a/builtin/providers/aws/resource_vpn_connection_route.go +++ b/builtin/providers/aws/resource_vpn_connection_route.go @@ -91,6 +91,12 @@ func resourceAwsVpnConnectionRouteRead(d *schema.ResourceData, meta interface{}) return err } } + if resp == nil || len(resp.VPNConnections) == 0 { + // This is kind of a weird edge case. I'd rather return an error + // instead of just blindly setting the ID to ""... since I don't know + // what might cause this. + return fmt.Errorf("No VPN connections returned") + } vpnConnection := resp.VPNConnections[0]