UNPKG

@pulumi/consul

Version:

A Pulumi package for creating and managing consul resources.

111 lines 4.72 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.AclToken = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The `consul.AclToken` resource writes an ACL token into Consul. * * > **NOTE:** The `consul.AclToken` resource does not save the secret ID of the generated token to the Terraform state to avoid leaking it when it is not needed. If you need to get the secret ID after creating the ACL token you can use the [`consul.getAclTokenSecretId`](https://www.terraform.io/docs/providers/consul/d/consul_acl_token_secret_id.html) datasource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as consul from "@pulumi/consul"; * import * as random from "@pulumi/random"; * * // Basic usage * const agent = new consul.AclPolicy("agent", { * name: "agent", * rules: `node_prefix \\"\\" { * policy = \\"read\\" * } * `, * }); * const test = new consul.AclToken("test", { * description: "my test token", * policies: [agent.name], * local: true, * }); * // Explicitly set the `accessor_id` * const testUuid = new random.index.Uuid("test", {}); * const testPredefinedId = new consul.AclToken("test_predefined_id", { * accessorId: testUuidRandomUuid.result, * description: "my test uuid token", * policies: [agent.name], * local: true, * }); * ``` * * ## Import * * ```sh * $ pulumi import consul:index/aclToken:AclToken anonymous 00000000-0000-0000-0000-000000000002 * $ pulumi import consul:index/aclToken:AclToken master-token 624d94ca-bc5c-f960-4e83-0a609cf588be * ``` */ class AclToken extends pulumi.CustomResource { /** * Get an existing AclToken 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 AclToken(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of AclToken. 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'] === AclToken.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["accessorId"] = state?.accessorId; resourceInputs["description"] = state?.description; resourceInputs["expirationTime"] = state?.expirationTime; resourceInputs["local"] = state?.local; resourceInputs["namespace"] = state?.namespace; resourceInputs["nodeIdentities"] = state?.nodeIdentities; resourceInputs["partition"] = state?.partition; resourceInputs["policies"] = state?.policies; resourceInputs["roles"] = state?.roles; resourceInputs["serviceIdentities"] = state?.serviceIdentities; resourceInputs["templatedPolicies"] = state?.templatedPolicies; } else { const args = argsOrState; resourceInputs["accessorId"] = args?.accessorId; resourceInputs["description"] = args?.description; resourceInputs["expirationTime"] = args?.expirationTime; resourceInputs["local"] = args?.local; resourceInputs["namespace"] = args?.namespace; resourceInputs["nodeIdentities"] = args?.nodeIdentities; resourceInputs["partition"] = args?.partition; resourceInputs["policies"] = args?.policies; resourceInputs["roles"] = args?.roles; resourceInputs["serviceIdentities"] = args?.serviceIdentities; resourceInputs["templatedPolicies"] = args?.templatedPolicies; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(AclToken.__pulumiType, name, resourceInputs, opts); } } exports.AclToken = AclToken; /** @internal */ AclToken.__pulumiType = 'consul:index/aclToken:AclToken'; //# sourceMappingURL=aclToken.js.map