databricksterraform-provider-awsaws-databricksterraform-provider-databricks

Error: cannot read mws workspaces: RESOURCE_DOES_NOT_EXIST: workspace 96783599 does not exist


When I do terraform apply. My workspace is getting created but I am getting the following error. I have looked to find the "workspace 96783599". But uanble to find the any resource with that number.

Error: cannot read mws workspaces: RESOURCE_DOES_NOT_EXIST: workspace 96783599 does not exist
│
│   with module.databricks_workspace_example.databricks_mws_workspaces.this,
│   on modules\workspace.tf line 1, in resource "databricks_mws_workspaces" "this":
│    1: resource "databricks_mws_workspaces" "this" {

Below is the workspace.tf

resource "databricks_mws_workspaces" "this" {
 
  account_id      = var.databricks_account_id
  aws_region      = var.aws_region
  workspace_name  = var.workspace
  #deployment_name = var.add_deployment_name

  credentials_id           = databricks_mws_credentials.this.credentials_id
  storage_configuration_id = databricks_mws_storage_configurations.this.storage_configuration_id
  network_id               = databricks_mws_networks.this.network_id

  token {
    comment = "Terraform"
    lifetime_seconds = var.token_lifetime_seconds
  }
}

Below is the main.tf

locals {
  resource_prefix = "databricks-terraform"

  workspace_name = "test-terraform"

  databricks_root_bucket_name = "databricks-terraform-root-bucket"

  default_tags = {
    "Project" = "databricks-terraform"
    "Team"    = "infrastructure"
  }

  databricks_subnets = [
    {
      main_subnet_cidr_block = "10.100.128.0/21",
      nat_subnet_cidr_block  = "10.100.152.0/24",
      availability_zone      = data.aws_availability_zones.available.names[0]
    },
    {
      main_subnet_cidr_block = "10.100.136.0/21",
      nat_subnet_cidr_block  = "10.100.153.0/24",
      availability_zone      = data.aws_availability_zones.available.names[1]
    }
  ]

  security_group_egress_ports = [80, 8080]

}

data "aws_region" "current" {
}

data "aws_availability_zones" "available" {
}

provider "databricks" {
  alias    = "mws"
  host     = "https://accounts.cloud.databricks.com"
  username = var.databricks_account_username
  password = var.databricks_account_password
}

module "databricks_workspace_example" {
  source = "./modules/"
  providers = {
    databricks = databricks.mws
  }
  
  resource_prefix             = local.resource_prefix
  workspace                   = local.workspace_name
  root_bucket_name            = local.databricks_root_bucket_name
  databricks_account_id       = var.databricks_account_id
  aws_region                  = data.aws_region.current.name
  default_tags                = local.default_tags
  vpc_id                      = var.vpc_id
  subnets                     = local.databricks_subnets
  security_group_egress_ports = local.security_group_egress_ports
}

provider "databricks" {
  alias = "workspace"
  host  = module.databricks_workspace_example.databricks_host
  token = module.databricks_workspace_example.databricks_token
}

I have followed the below github repo to

https://github.com/OSS-Nextail/terraform-aws-databricks-workspace-custom-vpc


Solution

  • Most probably the issue occurs because the 32-bit version of Databricks Terraform provider is used - Databricks uses 64-bit identifiers for workspace that are truncated when reading the data. You need to upgrade to 64-bit versions of Terraform and Databricks provider.