UNPKG

@pulumi/databricks

Version:

A Pulumi package for creating and managing databricks cloud resources.

164 lines 7.74 kB
"use strict"; // *** 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.StorageCredential = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * > This resource can be used with an account or workspace-level provider. * * 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. * * 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 * * This resource can be imported by name: * * bash * * ```sh * $ pulumi import databricks:index/storageCredential:StorageCredential this <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, Object.assign(Object.assign({}, 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 ? state.awsIamRole : undefined; resourceInputs["azureManagedIdentity"] = state ? state.azureManagedIdentity : undefined; resourceInputs["azureServicePrincipal"] = state ? state.azureServicePrincipal : undefined; resourceInputs["cloudflareApiToken"] = state ? state.cloudflareApiToken : undefined; resourceInputs["comment"] = state ? state.comment : undefined; resourceInputs["databricksGcpServiceAccount"] = state ? state.databricksGcpServiceAccount : undefined; resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined; resourceInputs["forceUpdate"] = state ? state.forceUpdate : undefined; resourceInputs["gcpServiceAccountKey"] = state ? state.gcpServiceAccountKey : undefined; resourceInputs["isolationMode"] = state ? state.isolationMode : undefined; resourceInputs["metastoreId"] = state ? state.metastoreId : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["owner"] = state ? state.owner : undefined; resourceInputs["readOnly"] = state ? state.readOnly : undefined; resourceInputs["skipValidation"] = state ? state.skipValidation : undefined; resourceInputs["storageCredentialId"] = state ? state.storageCredentialId : undefined; } else { const args = argsOrState; resourceInputs["awsIamRole"] = args ? args.awsIamRole : undefined; resourceInputs["azureManagedIdentity"] = args ? args.azureManagedIdentity : undefined; resourceInputs["azureServicePrincipal"] = args ? args.azureServicePrincipal : undefined; resourceInputs["cloudflareApiToken"] = args ? args.cloudflareApiToken : undefined; resourceInputs["comment"] = args ? args.comment : undefined; resourceInputs["databricksGcpServiceAccount"] = args ? args.databricksGcpServiceAccount : undefined; resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined; resourceInputs["forceUpdate"] = args ? args.forceUpdate : undefined; resourceInputs["gcpServiceAccountKey"] = args ? args.gcpServiceAccountKey : undefined; resourceInputs["isolationMode"] = args ? args.isolationMode : undefined; resourceInputs["metastoreId"] = args ? args.metastoreId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["owner"] = args ? args.owner : undefined; resourceInputs["readOnly"] = args ? args.readOnly : undefined; resourceInputs["skipValidation"] = args ? args.skipValidation : undefined; 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