Skip to content

Commit

Permalink
Fix state detection for the VPN Gateway.
Browse files Browse the repository at this point in the history
Related to hashicorp#7859.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
  • Loading branch information
kwilczynski committed Aug 1, 2016
1 parent 03590ca commit 6d927a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion builtin/providers/aws/resource_aws_vpn_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func resourceAwsVpnGatewayRead(d *schema.ResourceData, meta interface{}) error {
}

vpnGateway := resp.VpnGateways[0]
if vpnGateway == nil {
if vpnGateway == nil || *vpnGateway.State == "deleted" {
// Seems we have lost our VPN gateway
d.SetId("")
return nil
Expand Down
7 changes: 1 addition & 6 deletions builtin/providers/aws/resource_aws_vpn_gateway_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,7 @@ func resourceAwsVpnGatewayAttachmentRead(d *schema.ResourceData, meta interface{
return nil
}

if len(vgw.VpcAttachments) == 0 {
d.Set("vpc_id", "")
return nil
}

if *vgw.VpcAttachments[0].State == "detached" || *vgw.VpcAttachments[0].State == "deleted" {
if len(vgw.VpcAttachments) == 0 || *vgw.VpcAttachments[0].State == "detached" {
d.Set("vpc_id", "")
return nil
}
Expand Down

0 comments on commit 6d927a4

Please sign in to comment.