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

[ISSUE] Provider bug with databricks_permissions resource for sql endpoints #535

Closed
Hidoshi1 opened this issue Feb 24, 2021 · 1 comment · Fixed by #559
Closed

[ISSUE] Provider bug with databricks_permissions resource for sql endpoints #535

Hidoshi1 opened this issue Feb 24, 2021 · 1 comment · Fixed by #559
Assignees

Comments

@Hidoshi1
Copy link

Hidoshi1 commented Feb 24, 2021

Terraform Version

Terraform v0.14.5

Affected Resource(s)

Please list the resources as a list, for example:

  • databricks_permissions for sql endpoints (object type /sql/endpoints)

Environment variable names

DATABRICKS_HOST
DATABRICKS_TOKEN

Terraform Configuration Files

provider "registry.terraform.io/databrickslabs/databricks" {
  version     = "0.3.1"
  constraints = "0.3.1"
  hashes = [
    "...",
    "...",
  ]
}

Console Output (Terraform apply)

terraform apply

Terraform will perform the following actions:

  # databricks_permissions.endpoint_usage will be created
  + resource "databricks_permissions" "endpoint_usage" {
      + id              = (known after apply)
      + object_type     = (known after apply)
      + sql_endpoint_id = <REDACTED>

      + access_control {
          + group_name       = "users"
          + permission_level = "CAN_USE"
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

databricks_permissions.endpoint_usage: Creating...

Error: Unknown object type endpoints

Console Output (Terraform import)

databricks_permissions.endpoint_usage: Importing from ID "/sql/endpoints/<REDACTED>"...
databricks_permissions.endpoint_usage: Import prepared!
  Prepared databricks_permissions for import
databricks_permissions.endpoint_usage: Refreshing state... [id=/sql/endpoints/<REDACTED>]

Error: Unknown object type endpoints


Releasing state lock. This may take a few moments...

Debug Output (From TF_LOG=DEBUG terraform apply | grep databricks | sed -E 's/^.* plugin[^:]+: (.*)$/\1/'

2021-02-24T11:35:41.873+1100 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 args=[.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1]
path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 pid=1945
2021-02-24T11:35:41.877+1100 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1
Databricks Terraform Provider (experimental)

Version 0.3.1

https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs

configuring server automatic mTLS: timestamp=2021-02-24T11:35:41.894+1100
address=/var/folders/yk/q1d5dwz17l5f0yrx725p2_180000gn/T/plugin854688324 network=unix timestamp=2021-02-24T11:35:41.920+1100
path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 pid=1945
2021/02/24 11:35:41 [DEBUG] ProviderTransformer: "databricks_permissions.endpoint_usage" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/databrickslabs/databricks"]
2021/02/24 11:35:41 [DEBUG] ProviderTransformer: "databricks_sql_endpoint.sql_endpoint" (*terraform.NodeValidatableResource) needs provider["registry.terraform.io/databrickslabs/databricks"]
2021/02/24 11:35:41 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/databrickslabs/databricks\"]" references: []
2021/02/24 11:35:41 [DEBUG] ReferenceTransformer: "databricks_permissions.endpoint_usage" references: [databricks_sql_endpoint.sql_endpoint]
2021/02/24 11:35:41 [DEBUG] ReferenceTransformer: "databricks_sql_endpoint.sql_endpoint" references: [local.business_unit (expand) local.workspace_name (expand) local.resource_owner (expand) local.env (expand)]
2021-02-24T11:35:41.996+1100 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 args=[.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1]
path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 pid=1946
2021-02-24T11:35:41.999+1100 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1
Databricks Terraform Provider (experimental)

Version 0.3.1

https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs

configuring server automatic mTLS: timestamp=2021-02-24T11:35:42.013+1100
address=/var/folders/yk/q1d5dwz17l5f0yrx725p2_180000gn/T/plugin859853409 network=unix timestamp=2021-02-24T11:35:42.039+1100
Truncating attribute path of 0 diagnostics for TypeSet: timestamp=2021-02-24T11:35:42.092+1100
path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 pid=1946
2021/02/24 11:35:42 [DEBUG] ProviderTransformer: "databricks_sql_endpoint.sql_endpoint (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/databrickslabs/databricks"]
2021/02/24 11:35:42 [DEBUG] ProviderTransformer: "databricks_permissions.endpoint_usage (expand)" (*terraform.nodeExpandPlannableResource) needs provider["registry.terraform.io/databrickslabs/databricks"]
2021/02/24 11:35:42 [DEBUG] ReferenceTransformer: "provider[\"registry.terraform.io/databrickslabs/databricks\"]" references: []
2021/02/24 11:35:42 [DEBUG] ReferenceTransformer: "databricks_sql_endpoint.sql_endpoint (expand)" references: [local.business_unit (expand) local.workspace_name (expand) local.resource_owner (expand) local.env (expand)]
2021/02/24 11:35:42 [DEBUG] ReferenceTransformer: "databricks_permissions.endpoint_usage (expand)" references: [databricks_sql_endpoint.sql_endpoint (expand)]
2021-02-24T11:35:42.117+1100 [DEBUG] plugin: starting plugin: path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 args=[.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1]
path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 pid=1947
2021-02-24T11:35:42.120+1100 [DEBUG] plugin: waiting for RPC address: path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1
Databricks Terraform Provider (experimental)

Version 0.3.1

https://registry.terraform.io/providers/databrickslabs/databricks/latest/docs

configuring server automatic mTLS: timestamp=2021-02-24T11:35:42.135+1100
address=/var/folders/yk/q1d5dwz17l5f0yrx725p2_180000gn/T/plugin401543326 network=unix timestamp=2021-02-24T11:35:42.160+1100
Explicit and implicit attributes: host, token: timestamp=2021-02-24T11:35:42.210+1100
2021/02/24 11:35:42 [DEBUG] ReferenceTransformer: "databricks_sql_endpoint.sql_endpoint" references: []
databricks_sql_endpoint.sql_endpoint: Refreshing state... [id=2e0ffc6b44006fe5]
Using directly configured host+token authentication: timestamp=2021-02-24T11:35:42.212+1100
GET /sql/endpoints/2e0ffc6b44006fe5: timestamp=2021-02-24T11:35:42.212+1100
200 OK {
  "jdbc_url": <REDACTED>,
    "hostname": <REDACTED>,
2021/02/24 11:35:43 [WARN] Provider "registry.terraform.io/databrickslabs/databricks" produced an invalid plan for databricks_sql_endpoint.sql_endpoint, but we are tolerating it because it is using the legacy plugin SDK.
2021/02/24 11:35:43 [DEBUG] ReferenceTransformer: "databricks_permissions.endpoint_usage" references: []
databricks_permissions.endpoint_usage: Refreshing state... [id=/sql/endpoints/<REDACTED>]
GET /preview/permissions/sql/endpoints/<REDACTED>: timestamp=2021-02-24T11:35:43.380+1100
200 OK {
GET /preview/scim/v2/Me: timestamp=2021-02-24T11:35:43.993+1100
200 OK {
path=.terraform/providers/registry.terraform.io/databrickslabs/databricks/0.3.1/darwin_amd64/terraform-provider-databricks_v0.3.1 pid=1947

Panic Output

N/A

Expected Behavior

Attempting to create or import a databricks_permissions resource for a sql endpoint (coded as object type /sql/endpoints in this provider for this resource) is successful.

Actual Behavior

  • When applying, successfully updates permissions on the sql endpoint
  • Crashes before completing apply with error databricks_permissions.endpoint_usage: Creating... Error: Unknown object type endpoints
  • Subsequent terraform plans show output Error: Unknown object type endpoints
  • When importing the resource through terraform import databricks_permissions.<resource_name> /sql/endpoints/<endpoint_id>, yields the same output Error: Unknown object type endpoints

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. Have a databricks_permissions resource for a sql endpoint in your terraform code
  2. Run one of the following terraform apply or terraform import for the resource.

Important Factoids

Using creds from an admin service principal.

@Hidoshi1 Hidoshi1 changed the title [ISSUE] Provider bug [ISSUE] Provider bug with databricks_permissions resource for sql endpoints Feb 24, 2021
@alexott alexott self-assigned this Feb 25, 2021
@alexott alexott removed their assignment Mar 5, 2021
@nfx nfx linked a pull request Mar 11, 2021 that will close this issue
@nfx nfx closed this as completed in #559 Mar 18, 2021
@pietern
Copy link
Contributor

pietern commented Mar 18, 2021

@Hidoshi1 Can you give this another try with the development version of the provider?

@nfx nfx mentioned this issue Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants