databricks / terraform-provider-databricks

Databricks Terraform Provider
https://registry.terraform.io/providers/databricks/databricks/latest
Other
456 stars 393 forks source link

[ISSUE] Issue with `databricks_grant` resource #4151

Open bRameshShivakumar opened 1 month ago

bRameshShivakumar commented 1 month ago

Hello trying to add grant the permission to schema Note: already checked [Issue with databricks_grants resource

3630](https://github.com/databricks/terraform-provider-databricks/issues/3630)

this issue is with respect to access in system schema.

Configuration

 resource "databricks_schema" "databricks_service_schema" {
  provider = databricks.test
  catalog_name = "test_sandbox_we" # Replace with your catalog name
  name         = "sampletest"  # Replace with your schema name  
  comment      = "data bricks Schema for test"
}

resource "databricks_grants" "service_schema_permissions" {
  provider    = databricks.test
  schema        = "test_sandbox_we.${databricks_schema.databricks_service_schema.name}"
   grant {
    principal  = "testgroup"
    privileges = ["USE_SCHEMA", "MODIFY"]
  }

Expected Behavior

create new schema and assign permission to the griven principal

Actual Behavior

Error: cannot read grants: GetPermissions invalid schema name: 'sampletest'

Steps to Reproduce

Terraform and provider versions

terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "~>3.49, <4.0" } databricks = { source = "databricks/databricks" version = "1.48.3" } } }

provider "azurerm" { features {} }

provider "databricks" { host = "sandbox.databricks.net" alias = "test" }

Is it a regression?

tried with latest version version = ">=1.5.0","1.38

Debug Output

databricks_grants.service_schema_permissions: Refreshing state... [id=schema/sampletest] 2024-10-24T18:09:21.964+0530 [DEBUG] provider.terraform-provider-databricks_v1.48.3.exe: GET /api/2.1/unity-catalog/permissions/schema/sampletest < HTTP/2.0 400 Bad Request < { < "details": [ < { < "@type": "type.googleapis.com/google.rpc.RequestInfo", < "request_id": "94a6c62f-4d79-4d65-a833-ea77c4614c63", < "serving_data": "" < } < ], < "error_code": "INVALID_PARAMETER_VALUE", < "message": "GetPermissions invalid schema name: 'sampletest'"

Important Factoids

it is suppose to hit GET /api/2.1/unity-catalog/permissions/schema/test_sandbox_we.sampletest but it is refering only to /sampletest

Would you like to implement a fix?

currently no . but its a small bug

now it has become blocker even if i comment full come and apply still it is trying to read the permission. Regards Ramesh