Skip to content

Commit

Permalink
r/aws_glue_catalog_database: handle disappearing resources on delete (#…
Browse files Browse the repository at this point in the history
…35195)

* r/aws_glue_catalog_database: handle disappearing resources on delete

Previously 'EntityNotFound' errors were not handled during deletion, resulting in a hard error message where the provider should instead proceed without error.

* chore: changelog
  • Loading branch information
jar-b authored Jan 9, 2024
1 parent 316556b commit 3a31e2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/35195.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_glue_catalog_database: Properly handle out-of-band resource deletion
```
4 changes: 4 additions & 0 deletions internal/service/glue/catalog_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/service/glue"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
Expand Down Expand Up @@ -282,6 +283,9 @@ func resourceCatalogDatabaseDelete(ctx context.Context, d *schema.ResourceData,
Name: aws.String(d.Get("name").(string)),
CatalogId: aws.String(d.Get("catalog_id").(string)),
})
if tfawserr.ErrCodeEquals(err, glue.ErrCodeEntityNotFoundException) {
return diags
}
if err != nil {
return sdkdiag.AppendErrorf(diags, "deleting Glue Catalog Database (%s): %s", d.Id(), err)
}
Expand Down

0 comments on commit 3a31e2b

Please sign in to comment.