@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
193 lines • 8.07 kB
JavaScript
;
// *** 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.Credential = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant. Each credential is subject to Unity Catalog access-control policies that control which users and groups can access the credential.
*
* > This resource can only be used with a workspace-level provider!
*
* The type of credential to be created is determined by the `purpose` field, which should be either `SERVICE` or `STORAGE`.
* The caller must be a metastore admin or have the metastore privilege `CREATE_STORAGE_CREDENTIAL` for storage credentials, or `CREATE_SERVICE_CREDENTIAL` for service credentials. The user who creates the credential can delegate ownership to another user or group to manage permissions on it
*
* On AWS, the IAM role for a credential requires a trust policy. See [documentation](https://docs.databricks.com/en/connect/unity-catalog/cloud-services/service-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.Credential("external", {
* name: externalDataAccess.name,
* awsIamRole: {
* roleArn: externalDataAccess.arn,
* },
* purpose: "SERVICE",
* comment: "Managed by TF",
* });
* const externalCreds = new databricks.Grants("external_creds", {
* credential: external.id,
* grants: [{
* principal: "Data Engineers",
* privileges: ["ACCESS"],
* }],
* });
* ```
*
* For Azure
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const externalMi = new databricks.Credential("external_mi", {
* name: "mi_credential",
* azureManagedIdentity: {
* accessConnectorId: example.id,
* },
* purpose: "SERVICE",
* comment: "Managed identity credential managed by TF",
* });
* const externalCreds = new databricks.Grants("external_creds", {
* credential: externalMi.id,
* grants: [{
* principal: "Data Engineers",
* privileges: ["ACCESS"],
* }],
* });
* ```
*
* For GCP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as databricks from "@pulumi/databricks";
*
* const externalGcpSa = new databricks.Credential("external_gcp_sa", {
* name: "gcp_sa_credential",
* databricksGcpServiceAccount: {},
* purpose: "SERVICE",
* comment: "GCP SA credential managed by TF",
* });
* const externalCreds = new databricks.Grants("external_creds", {
* credential: externalGcpSa.id,
* grants: [{
* principal: "Data Engineers",
* privileges: ["ACCESS"],
* }],
* });
* ```
*
* ## Import
*
* This resource can be imported by name:
*
* hcl
*
* import {
*
* to = databricks_credential.this
*
* id = "<name>"
*
* }
*
* Alternatively, when using `terraform` version 1.4 or earlier, import using the `pulumi import` command:
*
* bash
*
* ```sh
* $ pulumi import databricks:index/credential:Credential this <name>
* ```
*/
class Credential extends pulumi.CustomResource {
/**
* Get an existing Credential 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 Credential(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Credential. 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'] === Credential.__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["comment"] = state?.comment;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["createdBy"] = state?.createdBy;
resourceInputs["credentialId"] = state?.credentialId;
resourceInputs["databricksGcpServiceAccount"] = state?.databricksGcpServiceAccount;
resourceInputs["forceDestroy"] = state?.forceDestroy;
resourceInputs["forceUpdate"] = state?.forceUpdate;
resourceInputs["fullName"] = state?.fullName;
resourceInputs["isolationMode"] = state?.isolationMode;
resourceInputs["metastoreId"] = state?.metastoreId;
resourceInputs["name"] = state?.name;
resourceInputs["owner"] = state?.owner;
resourceInputs["purpose"] = state?.purpose;
resourceInputs["readOnly"] = state?.readOnly;
resourceInputs["skipValidation"] = state?.skipValidation;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["updatedBy"] = state?.updatedBy;
resourceInputs["usedForManagedStorage"] = state?.usedForManagedStorage;
}
else {
const args = argsOrState;
if (args?.purpose === undefined && !opts.urn) {
throw new Error("Missing required property 'purpose'");
}
resourceInputs["awsIamRole"] = args?.awsIamRole;
resourceInputs["azureManagedIdentity"] = args?.azureManagedIdentity;
resourceInputs["azureServicePrincipal"] = args?.azureServicePrincipal;
resourceInputs["comment"] = args?.comment;
resourceInputs["createdAt"] = args?.createdAt;
resourceInputs["createdBy"] = args?.createdBy;
resourceInputs["databricksGcpServiceAccount"] = args?.databricksGcpServiceAccount;
resourceInputs["forceDestroy"] = args?.forceDestroy;
resourceInputs["forceUpdate"] = args?.forceUpdate;
resourceInputs["fullName"] = args?.fullName;
resourceInputs["isolationMode"] = args?.isolationMode;
resourceInputs["metastoreId"] = args?.metastoreId;
resourceInputs["name"] = args?.name;
resourceInputs["owner"] = args?.owner;
resourceInputs["purpose"] = args?.purpose;
resourceInputs["readOnly"] = args?.readOnly;
resourceInputs["skipValidation"] = args?.skipValidation;
resourceInputs["updatedAt"] = args?.updatedAt;
resourceInputs["updatedBy"] = args?.updatedBy;
resourceInputs["usedForManagedStorage"] = args?.usedForManagedStorage;
resourceInputs["credentialId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Credential.__pulumiType, name, resourceInputs, opts);
}
}
exports.Credential = Credential;
/** @internal */
Credential.__pulumiType = 'databricks:index/credential:Credential';
//# sourceMappingURL=credential.js.map