databricks / terraform-provider-databricks

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

[ISSUE] Issue with `databricks_grant` resource on external_location introduced on 1.48.0 #3705

Closed krknopp closed 2 months ago

krknopp commented 2 months ago

Configuration

We're trying to apply grants to an external location

resource "databricks_grants" "main" {
  external_location = "external1"
  id                = (known after apply)

  grant {
      principal  = "GROUP-NAME"
      privileges = [
          "ALL_PRIVILEGES",
        ]
    }
}

Expected Behavior

Grants should be applied

Actual Behavior

Grants aren't applied with it saying it can't find the group by name. It doesn't matter if the group name is specified as lower or upper case, the error always shows lower case. We were wondering if it had anything to do with the case sensitivity being removed in 1.48.0.

module.external_location_quality.databricks_grants.main: Creating...
2024-06-25T14:17:23.215-0500 [ERROR] provider.terraform-provider-databricks_v1.48.0: Response contains error diagnostic: @caller=/home/runner/work/terraform-provider-databricks/terraform-provider-databricks/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/diag/diagnostics.go:58 tf_provider_addr=registry.terraform.io/databricks/databricks diagnostic_detail="" diagnostic_severity=ERROR diagnostic_summary="cannot create grants: Could not find principal with name group-name" tf_proto_version=5.6 tf_req_id=37a13376-0db4-4936-971b-eeffbb094e31 tf_resource_type=databricks_grants @module=sdk.proto tf_rpc=ApplyResourceChange timestamp=2024-06-25T14:17:23.215-0500
2024-06-25T14:17:23.215-0500 [ERROR] vertex "module.external_location_quality.databricks_grants.main" error: cannot create grants: Could not find principal with name group-name
╷
│ Error: cannot create grants: Could not find principal with name group-name
│
│   with module.external_location_quality.databricks_grants.main,
│   on ../../modules/databricks-external-location/main.tf line 21, in resource "databricks_grants" "main":
│   21: resource "databricks_grants" "main" {
│

Steps to Reproduce

  1. terraform apply the above code with provider version 1.48.0.

Is it a regression?

yes, 1.47.0 and 1.46.0 both work properly.

chris-kolik-8451 commented 2 months ago

We are also experiencing the exact same issue with 1.48.0, though ours are with catalog/schema grants (almost the same code) rather than external locations, and have confirmed that reverting to 1.47.0 works for us.