UNPKG

@pulumi/databricks

Version:

A Pulumi package for creating and managing databricks cloud resources.

110 lines 5.3 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.ServicePrincipalSecret = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * With this resource you can create a secret for a given [Service Principals](https://docs.databricks.com/administration-guide/users-groups/service-principals.html). * * > This resource can only be used with an account-level or workspace-level provider! * * This secret can be used to configure the Databricks Pulumi Provider to authenticate with the service principal. See Authenticating with service principal. * * Additionally, the secret can be used to request OAuth tokens for the service principal, which can be used to authenticate to Databricks REST APIs. See [Authentication using OAuth tokens for service principals](https://docs.databricks.com/dev-tools/authentication-oauth.html). * * ## Example Usage * * Create service principal secret * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * * const terraformSp = new databricks.ServicePrincipalSecret("terraform_sp", {servicePrincipalId: _this.id}); * ``` * * A secret can be automatically rotated by taking a dependency on the `timeRotating` resource: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as databricks from "@pulumi/databricks"; * import * as time from "@pulumiverse/time"; * * const _this = new time.Rotating("this", {rotationDays: 30}); * const terraformSp = new databricks.ServicePrincipalSecret("terraform_sp", { * servicePrincipalId: thisDatabricksServicePrincipal.id, * timeRotating: pulumi.interpolate`Pulumi (created: ${_this.rfc3339})`, * }); * ``` * * ## Related Resources * * The following resources are often used in the same context: * * * databricks.ServicePrincipal to manage [Service Principals](https://docs.databricks.com/administration-guide/users-groups/service-principals.html) in Databricks */ class ServicePrincipalSecret extends pulumi.CustomResource { /** * Get an existing ServicePrincipalSecret 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 ServicePrincipalSecret(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ServicePrincipalSecret. 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'] === ServicePrincipalSecret.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createTime"] = state?.createTime; resourceInputs["expireTime"] = state?.expireTime; resourceInputs["lifetime"] = state?.lifetime; resourceInputs["secret"] = state?.secret; resourceInputs["secretHash"] = state?.secretHash; resourceInputs["servicePrincipalId"] = state?.servicePrincipalId; resourceInputs["status"] = state?.status; resourceInputs["timeRotating"] = state?.timeRotating; resourceInputs["updateTime"] = state?.updateTime; } else { const args = argsOrState; if (args?.servicePrincipalId === undefined && !opts.urn) { throw new Error("Missing required property 'servicePrincipalId'"); } resourceInputs["createTime"] = args?.createTime; resourceInputs["expireTime"] = args?.expireTime; resourceInputs["lifetime"] = args?.lifetime; resourceInputs["secret"] = args?.secret ? pulumi.secret(args.secret) : undefined; resourceInputs["secretHash"] = args?.secretHash; resourceInputs["servicePrincipalId"] = args?.servicePrincipalId; resourceInputs["status"] = args?.status; resourceInputs["timeRotating"] = args?.timeRotating; resourceInputs["updateTime"] = args?.updateTime; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["secret"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(ServicePrincipalSecret.__pulumiType, name, resourceInputs, opts); } } exports.ServicePrincipalSecret = ServicePrincipalSecret; /** @internal */ ServicePrincipalSecret.__pulumiType = 'databricks:index/servicePrincipalSecret:ServicePrincipalSecret'; //# sourceMappingURL=servicePrincipalSecret.js.map