@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
199 lines • 10.1 kB
JavaScript
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.MwsNetworks = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Example Usage
*
* ### Creating a Databricks on GCP workspace
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
* import * as google from "@pulumi/google";
*
* const config = new pulumi.Config();
* // Account Id that could be found in the top right corner of https://accounts.cloud.databricks.com/
* const databricksAccountId = config.requireObject<any>("databricksAccountId");
* const dbxPrivateVpc = new google.index.ComputeNetwork("dbx_private_vpc", {
* project: googleProject,
* name: `tf-network-${suffix.result}`,
* autoCreateSubnetworks: false,
* });
* const network_with_private_secondary_ip_ranges = new google.index.ComputeSubnetwork("network-with-private-secondary-ip-ranges", {
* name: `test-dbx-${suffix.result}`,
* ipCidrRange: "10.0.0.0/16",
* region: "us-central1",
* network: dbxPrivateVpc.id,
* secondaryIpRange: [
* {
* rangeName: "pods",
* ipCidrRange: "10.1.0.0/16",
* },
* {
* rangeName: "svc",
* ipCidrRange: "10.2.0.0/20",
* },
* ],
* privateIpGoogleAccess: true,
* });
* const router = new google.index.ComputeRouter("router", {
* name: `my-router-${suffix.result}`,
* region: network_with_private_secondary_ip_ranges.region,
* network: dbxPrivateVpc.id,
* });
* const nat = new google.index.ComputeRouterNat("nat", {
* name: `my-router-nat-${suffix.result}`,
* router: router.name,
* region: router.region,
* natIpAllocateOption: "AUTO_ONLY",
* sourceSubnetworkIpRangesToNat: "ALL_SUBNETWORKS_ALL_IP_RANGES",
* });
* const _this = new databricks.MwsNetworks("this", {
* accountId: databricksAccountId,
* networkName: `test-demo-${suffix.result}`,
* gcpNetworkInfo: {
* networkProjectId: googleProject,
* vpcId: dbxPrivateVpc.name,
* subnetId: networkWithPrivateSecondaryIpRanges.name,
* subnetRegion: networkWithPrivateSecondaryIpRanges.region,
* podIpRangeName: "pods",
* serviceIpRangeName: "svc",
* },
* });
* ```
*
* In order to create a VPC [that leverages GCP Private Service Connect](https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/private-service-connect.html) you would need to add the `vpcEndpointId` Attributes from mwsVpcEndpoint resources into the databricks.MwsNetworks resource. For example:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const _this = new databricks.MwsNetworks("this", {
* accountId: databricksAccountId,
* networkName: `test-demo-${suffix.result}`,
* gcpNetworkInfo: {
* networkProjectId: googleProject,
* vpcId: dbxPrivateVpc.name,
* subnetId: networkWithPrivateSecondaryIpRanges.name,
* subnetRegion: networkWithPrivateSecondaryIpRanges.region,
* podIpRangeName: "pods",
* serviceIpRangeName: "svc",
* },
* vpcEndpoints: {
* dataplaneRelays: [relay.vpcEndpointId],
* restApis: [workspace.vpcEndpointId],
* },
* });
* ```
*
* ## Modifying networks on running workspaces (AWS only)
*
* Due to specifics of platform APIs, changing any attribute of network configuration would cause `databricks.MwsNetworks` to be re-created - deleted & added again with special case for running workspaces. Once network configuration is attached to a running databricks_mws_workspaces, you cannot delete it and `pulumi up` would result in `INVALID_STATE: Unable to delete, Network is being used by active workspace X` error. In order to modify any attributes of a network, you have to perform three different `pulumi up` steps:
*
* 1. Create a new `databricks.MwsNetworks` resource.
* 2. Update the `databricks.MwsWorkspaces` to point to the new `networkId`.
* 3. Delete the old `databricks.MwsNetworks` resource.
*
* ## Related Resources
*
* The following resources are used in the same context:
*
* * Provisioning Databricks on AWS guide.
* * Provisioning Databricks on AWS with Private Link guide.
* * Provisioning AWS Databricks workspaces with a Hub & Spoke firewall for data exfiltration protection guide.
* * Provisioning Databricks on GCP guide.
* * Provisioning Databricks workspaces on GCP with Private Service Connect guide.
* * databricks.MwsVpcEndpoint to register awsVpcEndpoint resources with Databricks such that they can be used as part of a databricks.MwsNetworks configuration.
* * databricks.MwsPrivateAccessSettings to create a Private Access Setting that can be used as part of a databricks.MwsWorkspaces resource to create a [Databricks Workspace that leverages AWS PrivateLink](https://docs.databricks.com/administration-guide/cloud-configurations/aws/privatelink.html) or [GCP Private Service Connect](https://docs.gcp.databricks.com/administration-guide/cloud-configurations/gcp/private-service-connect.html).
* * databricks.MwsWorkspaces to set up [AWS and GCP workspaces](https://docs.databricks.com/getting-started/overview.html#e2-architecture-1).
*
* ## Import
*
* This resource can be imported by Databricks account ID and network ID.
*
* ```sh
* $ pulumi import databricks:index/mwsNetworks:MwsNetworks this '<account_id>/<network_id>'
* ```
*
* ~> This resource does not support updates. If your configuration does not match the existing resource,
*
* the next `pulumi up` will cause the resource to be destroyed and recreated. After importing,
*
* verify that the configuration matches the existing resource by running `pulumi preview`.
*/
class MwsNetworks extends pulumi.CustomResource {
/**
* Get an existing MwsNetworks resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new MwsNetworks(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of MwsNetworks. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === MwsNetworks.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accountId"] = state ? state.accountId : undefined;
resourceInputs["creationTime"] = state ? state.creationTime : undefined;
resourceInputs["errorMessages"] = state ? state.errorMessages : undefined;
resourceInputs["gcpNetworkInfo"] = state ? state.gcpNetworkInfo : undefined;
resourceInputs["networkId"] = state ? state.networkId : undefined;
resourceInputs["networkName"] = state ? state.networkName : undefined;
resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined;
resourceInputs["subnetIds"] = state ? state.subnetIds : undefined;
resourceInputs["vpcEndpoints"] = state ? state.vpcEndpoints : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
resourceInputs["vpcStatus"] = state ? state.vpcStatus : undefined;
resourceInputs["workspaceId"] = state ? state.workspaceId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.accountId === undefined) && !opts.urn) {
throw new Error("Missing required property 'accountId'");
}
if ((!args || args.networkName === undefined) && !opts.urn) {
throw new Error("Missing required property 'networkName'");
}
resourceInputs["accountId"] = (args === null || args === void 0 ? void 0 : args.accountId) ? pulumi.secret(args.accountId) : undefined;
resourceInputs["creationTime"] = args ? args.creationTime : undefined;
resourceInputs["errorMessages"] = args ? args.errorMessages : undefined;
resourceInputs["gcpNetworkInfo"] = args ? args.gcpNetworkInfo : undefined;
resourceInputs["networkId"] = args ? args.networkId : undefined;
resourceInputs["networkName"] = args ? args.networkName : undefined;
resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined;
resourceInputs["subnetIds"] = args ? args.subnetIds : undefined;
resourceInputs["vpcEndpoints"] = args ? args.vpcEndpoints : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["vpcStatus"] = args ? args.vpcStatus : undefined;
resourceInputs["workspaceId"] = args ? args.workspaceId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["accountId"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(MwsNetworks.__pulumiType, name, resourceInputs, opts);
}
}
exports.MwsNetworks = MwsNetworks;
/** @internal */
MwsNetworks.__pulumiType = 'databricks:index/mwsNetworks:MwsNetworks';
//# sourceMappingURL=mwsNetworks.js.map
;