UNPKG

@pulumi/databricks

Version:

A Pulumi package for creating and managing databricks cloud resources.

196 lines 7.93 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.StorageCredential = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * To work with external tables, Unity Catalog introduces two new objects to access and work with external cloud storage: * * - `databricks.StorageCredential` represents authentication methods to access cloud storage (e.g. an IAM role for Amazon S3 or a service principal/managed identity for Azure Storage). Storage credentials are access-controlled to determine which users can use the credential. * - databricks.ExternalLocation are objects that combine a cloud storage path with a Storage Credential that can be used to access the location. * * > This resource can be used with an account or workspace-level provider. * * On AWS, the IAM role for a storage credential requires a trust policy. See [documentation](https://docs.databricks.com/en/connect/unity-catalog/cloud-storage/storage-credentials.html#step-1-create-an-iam-role) for more details. The data source databricks.getAwsUnityCatalogAssumeRolePolicy can be used to create the necessary AWS Unity Catalog assume role policy. * * ## Example Usage * * For AWS * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const external = new databricks.StorageCredential("external", { * name: externalDataAccess.name, * awsIamRole: { * roleArn: externalDataAccess.arn, * }, * comment: "Managed by TF", * }); * const externalCreds = new databricks.Grants("external_creds", { * storageCredential: external.id, * grants: [{ * principal: "Data Engineers", * privileges: ["CREATE_EXTERNAL_TABLE"], * }], * }); * ``` * * For Azure * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const externalMi = new databricks.StorageCredential("external_mi", { * name: "mi_credential", * azureManagedIdentity: { * accessConnectorId: example.id, * }, * comment: "Managed identity credential managed by TF", * }); * const externalCreds = new databricks.Grants("external_creds", { * storageCredential: externalMi.id, * grants: [{ * principal: "Data Engineers", * privileges: ["CREATE_EXTERNAL_TABLE"], * }], * }); * ``` * * For GCP * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const external = new databricks.StorageCredential("external", { * name: "the-creds", * databricksGcpServiceAccount: {}, * }); * const externalCreds = new databricks.Grants("external_creds", { * storageCredential: external.id, * grants: [{ * principal: "Data Engineers", * privileges: ["CREATE_EXTERNAL_TABLE"], * }], * }); * ``` * * ## Import * * When using a workspace-level provider to manage storage credentials, this resource can be imported by name: * * hcl * * import { * * to = databricks_storage_credential.this * * id = "<storage_credential_name>" * * } * * When using an account-level provider to manage storage credentials, use the format `<metastore_id>|<storage_credential_name>`: * * hcl * * import { * * to = databricks_storage_credential.this * * id = "<metastore_id>|<storage_credential_name>" * * } * * Alternatively, when using `terraform` version 1.4 or earlier, import using the `pulumi import` command: * * bash * * When using a workspace-level provider * * ```sh * $ pulumi import databricks:index/storageCredential:StorageCredential this <storage_credential_name> * ``` * * When using an account-level provider * * ```sh * $ pulumi import databricks:index/storageCredential:StorageCredential this <metastore_id>|<storage_credential_name> * ``` */ class StorageCredential extends pulumi.CustomResource { /** * Get an existing StorageCredential 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 StorageCredential(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of StorageCredential. 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'] === StorageCredential.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["awsIamRole"] = state?.awsIamRole; resourceInputs["azureManagedIdentity"] = state?.azureManagedIdentity; resourceInputs["azureServicePrincipal"] = state?.azureServicePrincipal; resourceInputs["cloudflareApiToken"] = state?.cloudflareApiToken; resourceInputs["comment"] = state?.comment; resourceInputs["databricksGcpServiceAccount"] = state?.databricksGcpServiceAccount; resourceInputs["forceDestroy"] = state?.forceDestroy; resourceInputs["forceUpdate"] = state?.forceUpdate; resourceInputs["gcpServiceAccountKey"] = state?.gcpServiceAccountKey; resourceInputs["isolationMode"] = state?.isolationMode; resourceInputs["metastoreId"] = state?.metastoreId; resourceInputs["name"] = state?.name; resourceInputs["owner"] = state?.owner; resourceInputs["readOnly"] = state?.readOnly; resourceInputs["skipValidation"] = state?.skipValidation; resourceInputs["storageCredentialId"] = state?.storageCredentialId; } else { const args = argsOrState; resourceInputs["awsIamRole"] = args?.awsIamRole; resourceInputs["azureManagedIdentity"] = args?.azureManagedIdentity; resourceInputs["azureServicePrincipal"] = args?.azureServicePrincipal; resourceInputs["cloudflareApiToken"] = args?.cloudflareApiToken; resourceInputs["comment"] = args?.comment; resourceInputs["databricksGcpServiceAccount"] = args?.databricksGcpServiceAccount; resourceInputs["forceDestroy"] = args?.forceDestroy; resourceInputs["forceUpdate"] = args?.forceUpdate; resourceInputs["gcpServiceAccountKey"] = args?.gcpServiceAccountKey; resourceInputs["isolationMode"] = args?.isolationMode; resourceInputs["metastoreId"] = args?.metastoreId; resourceInputs["name"] = args?.name; resourceInputs["owner"] = args?.owner; resourceInputs["readOnly"] = args?.readOnly; resourceInputs["skipValidation"] = args?.skipValidation; resourceInputs["storageCredentialId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(StorageCredential.__pulumiType, name, resourceInputs, opts); } } exports.StorageCredential = StorageCredential; /** @internal */ StorageCredential.__pulumiType = 'databricks:index/storageCredential:StorageCredential'; //# sourceMappingURL=storageCredential.js.map