Skip to content

Commit

Permalink
provider/aws: Fix panic in VPN connection resource
Browse files Browse the repository at this point in the history
Check to ensure that vpnConnection.CustomerGatewayConfiguration is not
nil prior to dereferencing it on read.

Fixes #5647.
  • Loading branch information
jen20 committed Mar 21, 2016
1 parent 3bb9903 commit 6732659
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions builtin/providers/aws/resource_aws_vpn_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,13 @@ func resourceAwsVpnConnectionRead(d *schema.ResourceData, meta interface{}) erro
// Set read only attributes.
d.Set("customer_gateway_configuration", vpnConnection.CustomerGatewayConfiguration)

tunnelInfo := xmlConfigToTunnelInfo(*vpnConnection.CustomerGatewayConfiguration)
d.Set("tunnel1_address", tunnelInfo.Tunnel1Address)
d.Set("tunnel1_preshared_key", tunnelInfo.Tunnel1PreSharedKey)
d.Set("tunnel2_address", tunnelInfo.Tunnel2Address)
d.Set("tunnel2_preshared_key", tunnelInfo.Tunnel2PreSharedKey)
if vpnConnection.CustomerGatewayConfiguration != nil {
tunnelInfo := xmlConfigToTunnelInfo(*vpnConnection.CustomerGatewayConfiguration)
d.Set("tunnel1_address", tunnelInfo.Tunnel1Address)
d.Set("tunnel1_preshared_key", tunnelInfo.Tunnel1PreSharedKey)
d.Set("tunnel2_address", tunnelInfo.Tunnel2Address)
d.Set("tunnel2_preshared_key", tunnelInfo.Tunnel2PreSharedKey)
}

if err := d.Set("vgw_telemetry", telemetryToMapList(vpnConnection.VgwTelemetry)); err != nil {
return err
Expand Down

0 comments on commit 6732659

Please sign in to comment.