Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

b/aws_lakeformation_permissions: properly remove data cells filters #39026

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading