From 7e9392e72c626c07dfad65238a807872c50154fd Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Mon, 28 Dec 2020 12:29:11 -0800 Subject: [PATCH] Treat InvalidDhcpOptionsId.NotFound as already-deleted --- pkg/resources/aws/aws.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/resources/aws/aws.go b/pkg/resources/aws/aws.go index 288cbba327fa0..1eab6688fcc24 100644 --- a/pkg/resources/aws/aws.go +++ b/pkg/resources/aws/aws.go @@ -933,7 +933,10 @@ func DeleteDhcpOptions(cloud fi.Cloud, r *resources.Resource) error { } _, err := c.EC2().DeleteDhcpOptions(request) if err != nil { - if IsDependencyViolation(err) { + if awsup.AWSErrorCode(err) == "InvalidDhcpOptionsID.NotFound" { + klog.V(2).Infof("Got InvalidDhcpOptionsID.NotFound error deleting DhcpOptions %q; will treat as already-deleted", id) + return nil + } else if IsDependencyViolation(err) { return err } return fmt.Errorf("error deleting DhcpOptions %q: %v", id, err)