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

Explicitly set securable field when reading databricks_grants or databricks_grant #3246

Merged
merged 1 commit into from
Feb 12, 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
6 changes: 5 additions & 1 deletion catalog/resource_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ func ResourceGrant() common.Resource {
if err != nil {
return err
}
return common.StructToData(*grantsForPrincipal, s, d)
err = common.StructToData(*grantsForPrincipal, s, d)
if err != nil {
return err
}
return d.Set(securable, name)
},
Update: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
Expand Down
7 changes: 6 additions & 1 deletion catalog/resource_grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,12 @@ func ResourceGrants() common.Resource {
if len(grants.PrivilegeAssignments) == 0 {
return apierr.NotFound("got empty permissions list")
}
return common.StructToData(sdkPermissionsListToPermissionsList(*grants), s, d)

err = common.StructToData(sdkPermissionsListToPermissionsList(*grants), s, d)
if err != nil {
return err
}
return d.Set(securable, name)
},
Update: func(ctx context.Context, d *schema.ResourceData, c *common.DatabricksClient) error {
w, err := c.WorkspaceClient()
Expand Down
9 changes: 9 additions & 0 deletions docs/resources/grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,12 @@ resource "databricks_grant" "some" {
## Other access control

You can control Databricks General Permissions through [databricks_permissions](permissions.md) resource.

## Import

The resource can be imported using combination of securable type (`table`, `catalog`, `foreign_connection`, ...), it's name and `principal`:

```bash
terraform import databricks_grant.this catalog/abc/user_name
```

9 changes: 9 additions & 0 deletions docs/resources/grants.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,12 @@ resource "databricks_grants" "some" {
## Other access control

You can control Databricks General Permissions through [databricks_permissions](permissions.md) resource.

## Import

The resource can be imported using combination of securable type (`table`, `catalog`, `foreign_connection`, ...) and it's name:

```bash
terraform import databricks_grants.this catalog/abc
```

Loading