@pulumi/databricks
Version:
A Pulumi package for creating and managing databricks cloud resources.
110 lines • 5.69 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.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 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, Object.assign(Object.assign({}, 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 ? state.createTime : undefined;
resourceInputs["expireTime"] = state ? state.expireTime : undefined;
resourceInputs["lifetime"] = state ? state.lifetime : undefined;
resourceInputs["secret"] = state ? state.secret : undefined;
resourceInputs["secretHash"] = state ? state.secretHash : undefined;
resourceInputs["servicePrincipalId"] = state ? state.servicePrincipalId : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["timeRotating"] = state ? state.timeRotating : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.servicePrincipalId === undefined) && !opts.urn) {
throw new Error("Missing required property 'servicePrincipalId'");
}
resourceInputs["createTime"] = args ? args.createTime : undefined;
resourceInputs["expireTime"] = args ? args.expireTime : undefined;
resourceInputs["lifetime"] = args ? args.lifetime : undefined;
resourceInputs["secret"] = (args === null || args === void 0 ? void 0 : args.secret) ? pulumi.secret(args.secret) : undefined;
resourceInputs["secretHash"] = args ? args.secretHash : undefined;
resourceInputs["servicePrincipalId"] = args ? args.servicePrincipalId : undefined;
resourceInputs["status"] = args ? args.status : undefined;
resourceInputs["timeRotating"] = args ? args.timeRotating : undefined;
resourceInputs["updateTime"] = args ? args.updateTime : undefined;
}
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