Skip to content

Commit

Permalink
Merge pull request #6089 from alvaroaleman/destroy-endpoint-service
Browse files Browse the repository at this point in the history
AWS Destroy: Clean up endpoint services
  • Loading branch information
openshift-ci[bot] committed Jul 7, 2022
2 parents a0108db + d120c2f commit 4c1b1c1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/destroy/aws/aws.go
Expand Up @@ -782,6 +782,8 @@ func deleteEC2(ctx context.Context, session *session.Session, arn arn.ARN, logge
return deleteEC2VPCEndpoint(ctx, client, id, logger)
case "vpc-peering-connection":
return deleteEC2VPCPeeringConnection(ctx, client, id, logger)
case "vpc-endpoint-service":
return deleteEC2VPCEndpointService(ctx, client, id, logger)
default:
return errors.Errorf("unrecognized EC2 resource type %s", resourceType)
}
Expand Down Expand Up @@ -1438,6 +1440,20 @@ func deleteEC2VPCPeeringConnection(ctx context.Context, client *ec2.EC2, id stri
return nil
}

func deleteEC2VPCEndpointService(ctx context.Context, client *ec2.EC2, id string, logger logrus.FieldLogger) error {
_, err := client.DeleteVpcEndpointServiceConfigurationsWithContext(ctx, &ec2.DeleteVpcEndpointServiceConfigurationsInput{
ServiceIds: aws.StringSlice([]string{id}),
})
if err != nil {
if err.(awserr.Error).Code() == "InvalidVpcEndpointService.NotFound" {
return nil
}
return errors.Wrapf(err, "cannot delete VPC Endpoint Service %s", id)
}
logger.Info("Deleted")
return nil
}

func deleteElasticLoadBalancing(ctx context.Context, session *session.Session, arn arn.ARN, logger logrus.FieldLogger) error {
resourceType, id, err := splitSlash("resource", arn.Resource)
if err != nil {
Expand Down

0 comments on commit 4c1b1c1

Please sign in to comment.