Skip to content

Commit

Permalink
Merge pull request #39026 from hashicorp/b-revoke_data_cells_filter
Browse files Browse the repository at this point in the history
b/aws_lakeformation_permissions: properly remove data cells filters
  • Loading branch information
johnsonaj authored Aug 26, 2024
2 parents 8b3e7ce + a249798 commit d34fbbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/39026.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_lakeformation_permissions: Fix error when revoking `data_cells_filter` permissions
```
8 changes: 8 additions & 0 deletions internal/service/lakeformation/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,10 @@ func resourcePermissionsDelete(ctx context.Context, d *schema.ResourceData, meta
input.Resource.Catalog = ExpandCatalogResource()
}

if v, ok := d.GetOk("data_cells_filter"); ok {
input.Resource.DataCellsFilter = ExpandDataCellsFilter(v.([]interface{}))
}

if v, ok := d.GetOk("data_location"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
input.Resource.DataLocation = ExpandDataLocationResource(v.([]interface{})[0].(map[string]interface{}))
}
Expand Down Expand Up @@ -817,6 +821,10 @@ func resourcePermissionsDelete(ctx context.Context, d *schema.ResourceData, meta
return diags
}

if errs.IsAErrorMessageContains[*awstypes.InvalidInputException](err, "Cell Filter not found") {
return diags
}

if err != nil {
return sdkdiag.AppendErrorf(diags, "unable to revoke LakeFormation Permissions (input: %v): %s", input, err)
}
Expand Down

0 comments on commit d34fbbf

Please sign in to comment.