diff --git a/aws/resource_aws_ec2_client_vpn_authorization_rule.go b/aws/resource_aws_ec2_client_vpn_authorization_rule.go index 4c6bc581a4a..1940ad3d33d 100644 --- a/aws/resource_aws_ec2_client_vpn_authorization_rule.go +++ b/aws/resource_aws_ec2_client_vpn_authorization_rule.go @@ -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) } @@ -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 }