Skip to content

[BUG] cycle in the databricks_mws_networks resource for in the AWS module #38

Description

@bcmedeiros

Category

core-platform

Project Name

workspace-setup/terraform-examples/aws/aws-byovpc

What's the bug?

I'm using the AWS BYOVPC as a module like this:

module "byovpc" {
  source = "github.com/databricks-solutions/technical-services-solutions//workspace-setup/terraform-examples/aws/aws-byovpc/tf?ref=0f25522"

  databricks_account_id = ...
  metastore_id          = ...
  prefix                = ...
  vpc_id             = data.aws_vpc.main.id

  ...
}

Everything was working fine, but today I had to recreate my VPC and was bumping into the following error:

module.byovpc.databricks_mws_networks.this: Destroying...
Error: cannot delete mws networks: INVALID_STATE: Unable to delete, Network is being used by active workspace xxxxxxxxxxxxxxxx

After some debugging, I realized the issue is caused because the databricks_mws_networks is being deleted, but databricks_mws_workspaces still need it.
To fix this, you have to declare databricks_mws_networks with a create_before_destroy = true.

Fixed version:

resource "databricks_mws_networks" "this" {
  // ...

  lifecycle {
    create_before_destroy = true
  }
}

How to reproduce?

No response

Environment

No response

Checklist

  • I searched existing issues first
  • No sensitive information included

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions