hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.81k stars 9.16k forks source link

Sweepers: Should check for skippable errors on all error returns #16570

Open gdavison opened 3 years ago

gdavison commented 3 years ago

Most sweepers currently check for skippable errors using testSweepSkipSweepError() only at the listing level. In some cases, for example resources created by a central IT group, most instances of a resource can be swept but not all.

Identify a set of skippable errors for individual resources and check for them on all API calls in a sweeper.

tbugfinder commented 3 years ago

Hi @gdavison,

I was running make sweep within a member account and it failed on the GuardDuty Detector with: Should this have been skipped?

2020/12/23 19:31:43 [ERROR] error deleting GuardDuty Detector (1111111111111111): BadRequestException: The request is rejected because member cannot disassociate from Organization administrator
{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "555555555555555555555555555555555555555555"
  },
  Message_: "The request is rejected because member cannot disassociate from Organization administrator",
  Type: "InvalidInputException"
}
2020/12/23 19:31:43 [ERROR] Error running Sweeper (aws_guardduty_detector) in region (eu-west-1): 1 error occurred:
        * error deleting GuardDuty Detector (1111111111111111111111111111): BadRequestException: The request is rejected because member cannot disassociate from Organization administrator
{
  RespMetadata: {
    StatusCode: 400,
    RequestID: "5555555555555555555555555555555"
  },
  Message_: "The request is rejected because member cannot disassociate from Organization administrator",
  Type: "InvalidInputException"
}

FAIL    github.com/terraform-providers/terraform-provider-aws/aws       64.662s
FAIL
make: *** [sweep] Error 1
tbugfinder commented 3 years ago

I also just created issue #16898 which applies to shared transit gateways.

github-actions[bot] commented 1 year ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

tbugfinder commented 1 year ago

Bump