Skip to content

azurermDatabricksVirtualNetworkPeering

Manages a Databricks Virtual Network Peering

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "example-resources",
  }
);
const azurermVirtualNetworkRemote = new azurerm.virtualNetwork.VirtualNetwork(
  this,
  "remote",
  {
    address_space: ["10.0.1.0/24"],
    location: azurermResourceGroupExample.location,
    name: "remote-vnet",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
const azurermDatabricksWorkspaceExample =
  new azurerm.databricksWorkspace.DatabricksWorkspace(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "example-workspace",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "standard",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDatabricksWorkspaceExample.overrideLogicalId("example");
const azurermDatabricksVirtualNetworkPeeringExample =
  new azurerm.databricksVirtualNetworkPeering.DatabricksVirtualNetworkPeering(
    this,
    "example_3",
    {
      allow_virtual_network_access: true,
      name: "databricks-vnet-peer",
      remote_address_space_prefixes: azurermVirtualNetworkRemote.addressSpace,
      remote_virtual_network_id: azurermVirtualNetworkRemote.id,
      resource_group_name: azurermResourceGroupExample.name,
      workspace_id: azurermDatabricksWorkspaceExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermDatabricksVirtualNetworkPeeringExample.overrideLogicalId("example");
const azurermVirtualNetworkPeeringRemote =
  new azurerm.virtualNetworkPeering.VirtualNetworkPeering(this, "remote_4", {
    allow_virtual_network_access: true,
    name: "peer-to-databricks",
    remote_virtual_network_id:
      azurermDatabricksVirtualNetworkPeeringExample.virtualNetworkId,
    resource_group_name: azurermResourceGroupExample.name,
    virtual_network_name: azurermVirtualNetworkRemote.name,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkPeeringRemote.overrideLogicalId("remote");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Databricks Virtual Network Peering resource. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the Resource Group in which the Databricks Virtual Network Peering should exist. Changing this forces a new resource to be created.

  • workspaceId - (Required) The ID of the Databricks Workspace that this Databricks Virtual Network Peering is bound. Changing this forces a new resource to be created.

  • addressSpacePrefixes - (Required) A list of address blocks reserved for this virtual network in CIDR notation. Changing this forces a new resource to be created.

  • remoteAddressSpacePrefixes - (Required) A list of address blocks reserved for the remote virtual network in CIDR notation. Changing this forces a new resource to be created.

  • remoteVirtualNetworkId - (Required) The ID of the remote virtual network. Changing this forces a new resource to be created.

\~> NOTE: The remote virtual network should be in the same region as the databricks workspace. Please see the product documentation for more information.

  • allowVirtualNetworkAccess - (Optional) Can the VMs in the local virtual network space access the VMs in the remote virtual network space? Defaults to true.

  • allowForwardedTraffic - (Optional) Can the forwarded traffic from the VMs in the local virtual network be forwarded to the remote virtual network? Defaults to false.

  • allowGatewayTransit - (Optional) Can the gateway links be used in the remote virtual network to link to the Databricks virtual network? Defaults to false.

  • useRemoteGateways - (Optional) Can remote gateways be used on the Databricks virtual network? Defaults to false.

\~> NOTE: If the useRemoteGateways is set to true, and allowGatewayTransit on the remote peering is also true, the virtual network will use the gateways of the remote virtual network for transit. Only one peering can have this flag set to true. useRemoteGateways cannot be set if the virtual network already has a gateway.

  • virtualNetworkId - The ID of the internal Virtual Network used by the DataBricks Workspace.

\~> NOTE: The virtualNetworkId field is the value you must supply to the azurermVirtualNetworkPeering resources remoteVirtualNetworkId field to successfully peer the Databricks Virtual Network with the remote virtual network.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Databricks Virtual Network Peering.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Databricks Virtual Network Peering.
  • update - (Defaults to 30 minutes) Used when updating the Databricks Virtual Network Peering.
  • read - (Defaults to 5 minutes) Used when retrieving the Databricks Virtual Network Peering.
  • delete - (Defaults to 30 minutes) Used when deleting the Databricks Virtual Network Peering.

Import

Databrick Virtual Network Peerings can be imported using the resourceId, e.g.

terraform import azurerm_databricks_virtual_network_peering.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Databricks/workspaces/workspace1/virtualNetworkPeerings/peering1