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

Microsoft.Databricks/workspaces - nil pointer dereference exception, running plan when SKU is missing #16788

Closed
1 task done
cristovaovaz opened this issue May 13, 2022 · 2 comments · Fixed by #16819
Closed
1 task done
Assignees
Milestone

Comments

@cristovaovaz
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.1.9

AzureRM Provider Version

3.0.0

Affected Resource(s)/Data Source(s)

azurerm_databricks_workspace

Terraform Configuration Files

terraform {
  required_providers {
    databricks = {
      source  = "databrickslabs/databricks"
      version = ">= 0.3.6"
    }
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "3.0.0"
    }
  }
}

provider "azurerm" {
  features {}
  skip_provider_registration = true
}

provider "databricks" {
   host = data.azurerm_databricks_workspace.workspace.workspace_url
}


data "azurerm_client_config" "current" {
}

data "azurerm_databricks_workspace" "workspace" {
  name                              = "dbw-temp-002"
  resource_group_name               = "rg-temp-2022-05D"
}

Debug Output/Panic Output

$ terraform plan
╷
│ Error: Plugin did not respond
│
│   with data.azurerm_databricks_workspace.workspace,
│   on TF_Issue2.tf line 31, in data "azurerm_databricks_workspace" "workspace":
│   31: data "azurerm_databricks_workspace" "workspace" {
│
│ The plugin encountered an error, and failed to respond to the
│ plugin.(*GRPCProvider).ReadDataSource call. The plugin logs may contain
│ more details.
╵

Stack trace from the terraform-provider-azurerm_v3.0.0_x5.exe plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x4fb8514]

goroutine 86 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks.dataSourceDatabricksWorkspaceRead(0x68, {0x5ce13e0, 0xc001566380})
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/internal/services/databricks/databricks_workspace_data_source.go:73 +0x614
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x65d6f34, {0x6cf35d8, 0xc001716640}, 0xc001057620, {0x5ce13e0, 0xc001566380})
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:346 +0x178
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).ReadDataApply(0xc00090f0a0, {0x6cf35d8, 0xc001716640}, 0xc0008d7780, {0x5ce13e0, 0xc001566380})
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go:569 +0xf7
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadDataSource(0xc000005cf8, {0x6cf35d8, 0xc001716640}, 0xc001f2c740)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go:1133 +0x3a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadDataSource(0xc00024ef00, {0x6cf3680, 0xc001814000}, 0xc001164190)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server/server.go:478 +0x37b
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadDataSource_Handler({0x622a780, 0xc00024ef00}, {0x6cf3680, 0xc001814000}, 0xc001ffa180, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:416 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000a46a80, {0x6d44ce8, 0xc0005b7380}, 0xc001b23680, 0xc000151c80, 0xb3b9ed0, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:1292 +0xc6f
google.golang.org/grpc.(*Server).handleStream(0xc000a46a80, {0x6d44ce8, 0xc0005b7380}, 0xc001b23680, 0x0)
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:1617 +0xa2a
google.golang.org/grpc.(*Server).serveStreams.func1.2()
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:940 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/hashicorp/terraform-provider-azurerm/vendor/google.golang.org/grpc/server.go:938 +0x294

Error: The terraform-provider-azurerm_v3.0.0_x5.exe plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behaviour

terraform plan should complete

Actual Behaviour

terraform plan should complete

Steps to Reproduce

  1. Create Workspace without the SKU property
    {
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
    "location": {
    "type": "string",
    "defaultValue": "ukwest"
    },
    "workspaceName": {
    "type": "string",
    "defaultValue": "dbw-temp-002"
    }
    },
    "variables": {
    "managedResourceGroupName": "[concat('databricks-rg-', parameters('workspaceName'), '-', uniqueString(parameters('workspaceName'), resourceGroup().id))]",
    "managedResourceGroupId": "[concat(subscription().id, '/resourceGroups/', variables('managedResourceGroupName'))]"
    },
    "resources": [
    {
    "apiVersion": "2018-04-01",
    "location": "[parameters('location')]",
    "name": "[parameters('workspaceName')]",
    "comments": "Please do not use an existing resource group for ManagedResourceGroupId.",
    "properties": {
    "ManagedResourceGroupId": "[variables('managedResourceGroupId')]",
    "parameters": {}
    },
    "type": "Microsoft.Databricks/workspaces"
    }
    ]
    }
  2. Run terraform plan
  3. Confirm error

Important Factoids

No response

References

https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/services/databricks/databricks_workspace_data_source.go#L73 is checking for SKU.name when SKU isn't a mandatory property

@github-actions
Copy link

This functionality has been released in v3.7.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants