@pulumi/vault
Version:
A Pulumi package for creating and managing HashiCorp Vault cloud resources.
118 lines • 5.06 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.SecretBackendRole = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vault from "@pulumi/vault";
*
* const db = new vault.Mount("db", {
* path: "postgres",
* type: "database",
* });
* const postgres = new vault.database.SecretBackendConnection("postgres", {
* backend: db.path,
* name: "postgres",
* allowedRoles: [
* "dev",
* "prod",
* ],
* postgresql: {
* connectionUrl: "postgres://username:password@host:port/database",
* },
* });
* const role = new vault.database.SecretBackendRole("role", {
* backend: db.path,
* name: "dev",
* dbName: postgres.name,
* creationStatements: ["CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}';"],
* });
* ```
*
* ## Import
*
* Database secret backend roles can be imported using the `backend`, `/roles/`, and the `name` e.g.
*
* ```sh
* $ pulumi import vault:database/secretBackendRole:SecretBackendRole example postgres/roles/my-role
* ```
*/
class SecretBackendRole extends pulumi.CustomResource {
/**
* Get an existing SecretBackendRole 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 SecretBackendRole(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SecretBackendRole. 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'] === SecretBackendRole.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["backend"] = state?.backend;
resourceInputs["creationStatements"] = state?.creationStatements;
resourceInputs["credentialConfig"] = state?.credentialConfig;
resourceInputs["credentialType"] = state?.credentialType;
resourceInputs["dbName"] = state?.dbName;
resourceInputs["defaultTtl"] = state?.defaultTtl;
resourceInputs["maxTtl"] = state?.maxTtl;
resourceInputs["name"] = state?.name;
resourceInputs["namespace"] = state?.namespace;
resourceInputs["renewStatements"] = state?.renewStatements;
resourceInputs["revocationStatements"] = state?.revocationStatements;
resourceInputs["rollbackStatements"] = state?.rollbackStatements;
}
else {
const args = argsOrState;
if (args?.backend === undefined && !opts.urn) {
throw new Error("Missing required property 'backend'");
}
if (args?.creationStatements === undefined && !opts.urn) {
throw new Error("Missing required property 'creationStatements'");
}
if (args?.dbName === undefined && !opts.urn) {
throw new Error("Missing required property 'dbName'");
}
resourceInputs["backend"] = args?.backend;
resourceInputs["creationStatements"] = args?.creationStatements;
resourceInputs["credentialConfig"] = args?.credentialConfig;
resourceInputs["credentialType"] = args?.credentialType;
resourceInputs["dbName"] = args?.dbName;
resourceInputs["defaultTtl"] = args?.defaultTtl;
resourceInputs["maxTtl"] = args?.maxTtl;
resourceInputs["name"] = args?.name;
resourceInputs["namespace"] = args?.namespace;
resourceInputs["renewStatements"] = args?.renewStatements;
resourceInputs["revocationStatements"] = args?.revocationStatements;
resourceInputs["rollbackStatements"] = args?.rollbackStatements;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SecretBackendRole.__pulumiType, name, resourceInputs, opts);
}
}
exports.SecretBackendRole = SecretBackendRole;
/** @internal */
SecretBackendRole.__pulumiType = 'vault:database/secretBackendRole:SecretBackendRole';
//# sourceMappingURL=secretBackendRole.js.map