@pulumi/vault
Version:
A Pulumi package for creating and managing HashiCorp Vault cloud resources.
128 lines • 5.88 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.AuthBackendConfig = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* You can setup the Azure auth engine with Workload Identity Federation (WIF) for a secret-less configuration:
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
*
* const example = new vault.AuthBackend("example", {
* type: "azure",
* identityTokenKey: "example-key",
* });
* const exampleAuthBackendConfig = new vault.azure.AuthBackendConfig("example", {
* backend: example.path,
* tenantId: "11111111-2222-3333-4444-555555555555",
* clientId: "11111111-2222-3333-4444-555555555555",
* identityTokenAudience: "<TOKEN_AUDIENCE>",
* identityTokenTtl: "<TOKEN_TTL>",
* rotationSchedule: "0 * * * SAT",
* rotationWindow: 3600,
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
*
* const example = new vault.AuthBackend("example", {type: "azure"});
* const exampleAuthBackendConfig = new vault.azure.AuthBackendConfig("example", {
* backend: example.path,
* tenantId: "11111111-2222-3333-4444-555555555555",
* clientId: "11111111-2222-3333-4444-555555555555",
* clientSecret: "01234567890123456789",
* resource: "https://vault.hashicorp.com",
* rotationSchedule: "0 * * * SAT",
* rotationWindow: 3600,
* });
* ```
*
* ## Import
*
* Azure auth backends can be imported using `auth/`, the `backend` path, and `/config` e.g.
*
* ```sh
* $ pulumi import vault:azure/authBackendConfig:AuthBackendConfig example auth/azure/config
* ```
*/
class AuthBackendConfig extends pulumi.CustomResource {
/**
* Get an existing AuthBackendConfig 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 AuthBackendConfig(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AuthBackendConfig. 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'] === AuthBackendConfig.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["backend"] = state?.backend;
resourceInputs["clientId"] = state?.clientId;
resourceInputs["clientSecret"] = state?.clientSecret;
resourceInputs["disableAutomatedRotation"] = state?.disableAutomatedRotation;
resourceInputs["environment"] = state?.environment;
resourceInputs["identityTokenAudience"] = state?.identityTokenAudience;
resourceInputs["identityTokenTtl"] = state?.identityTokenTtl;
resourceInputs["namespace"] = state?.namespace;
resourceInputs["resource"] = state?.resource;
resourceInputs["rotationPeriod"] = state?.rotationPeriod;
resourceInputs["rotationSchedule"] = state?.rotationSchedule;
resourceInputs["rotationWindow"] = state?.rotationWindow;
resourceInputs["tenantId"] = state?.tenantId;
}
else {
const args = argsOrState;
if (args?.resource === undefined && !opts.urn) {
throw new Error("Missing required property 'resource'");
}
if (args?.tenantId === undefined && !opts.urn) {
throw new Error("Missing required property 'tenantId'");
}
resourceInputs["backend"] = args?.backend;
resourceInputs["clientId"] = args?.clientId ? pulumi.secret(args.clientId) : undefined;
resourceInputs["clientSecret"] = args?.clientSecret ? pulumi.secret(args.clientSecret) : undefined;
resourceInputs["disableAutomatedRotation"] = args?.disableAutomatedRotation;
resourceInputs["environment"] = args?.environment;
resourceInputs["identityTokenAudience"] = args?.identityTokenAudience;
resourceInputs["identityTokenTtl"] = args?.identityTokenTtl;
resourceInputs["namespace"] = args?.namespace;
resourceInputs["resource"] = args?.resource;
resourceInputs["rotationPeriod"] = args?.rotationPeriod;
resourceInputs["rotationSchedule"] = args?.rotationSchedule;
resourceInputs["rotationWindow"] = args?.rotationWindow;
resourceInputs["tenantId"] = args?.tenantId ? pulumi.secret(args.tenantId) : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["clientId", "clientSecret", "tenantId"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(AuthBackendConfig.__pulumiType, name, resourceInputs, opts);
}
}
exports.AuthBackendConfig = AuthBackendConfig;
/** @internal */
AuthBackendConfig.__pulumiType = 'vault:azure/authBackendConfig:AuthBackendConfig';
//# sourceMappingURL=authBackendConfig.js.map