Skip to content

Commit

Permalink
fix: remove client-vpn endpoints from state when they are missing
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielCastro committed Sep 20, 2019
1 parent 8aa2cac commit 965f3e9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions aws/resource_aws_ec2_client_vpn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ func resourceAwsEc2ClientVpnEndpointRead(d *schema.ResourceData, meta interface{
ClientVpnEndpointIds: []*string{aws.String(d.Id())},
})

if isAWSErr(err, "InvalidClientVpnAssociationId.NotFound", "") || isAWSErr(err, "InvalidClientVpnEndpointId.NotFound", "") {
log.Printf("[WARN] EC2 Client VPN Endpoint (%s) not found, removing from state", d.Id())
d.SetId("")
return nil
}

if err != nil {
return fmt.Errorf("Error reading Client VPN endpoint: %s", err)
}
Expand Down

0 comments on commit 965f3e9

Please sign in to comment.