Skip to content

Commit

Permalink
Client vpn endpoint not found implies authorization rule does not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Oct 17, 2020
1 parent 5bcbfd0 commit 4ffbdea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions aws/resource_aws_ec2_client_vpn_authorization_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ func resourceAwsEc2ClientVpnAuthorizationRuleRead(d *schema.ResourceData, meta i
d.SetId("")
return nil
}
if isAWSErr(err, tfec2.ErrCodeClientVpnEndpointIdNotFound, "") {
log.Printf("[WARN] EC2 Client VPN (%s) not found, removing rule from state", d.Id())
d.SetId("")
return nil
}
if err != nil {
return fmt.Errorf("error reading Client VPN authorization rule: %w", err)
}
Expand Down Expand Up @@ -174,6 +179,9 @@ func deleteClientVpnAuthorizationRule(conn *ec2.EC2, input *ec2.RevokeClientVpnI
if isAWSErr(err, tfec2.ErrCodeClientVpnAuthorizationRuleNotFound, "") {
return nil
}
if isAWSErr(err, tfec2.ErrCodeClientVpnEndpointIdNotFound, "") {
return nil
}
if err != nil {
return err
}
Expand Down

0 comments on commit 4ffbdea

Please sign in to comment.