@pulumi/consul
Version:
A Pulumi package for creating and managing consul resources.
221 lines (220 loc) • 8.44 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "./types/input";
import * as outputs from "./types/output";
/**
* Allows Terraform to manage a "namespace" of Consul keys that share a common
* name prefix.
*
* Like `consul.Keys`, this resource can write values into the Consul key/value
* store, but *unlike* `consul.Keys` this resource can detect and remove extra
* keys that have been added some other way, thus ensuring that rogue data
* added outside of Terraform will be removed on the next run.
*
* This resource is thus useful in the case where Terraform is exclusively
* managing a set of related keys.
*
* To avoid accidentally clobbering matching data that existed in Consul before
* a `consul.KeyPrefix` resource was created, creation of a key prefix instance
* will fail if any matching keys are already present in the key/value store.
* If any conflicting data is present, you must first delete it manually or
* explicitly import the prefix.
*
* > **Warning** After this resource is instantiated, Terraform takes control
* over *all* keys with the given path prefix, and will remove any matching keys
* that are not present in the configuration. It will also delete *all* keys under
* the given prefix when a `consul.KeyPrefix` resource is destroyed, even if
* those keys were created outside of Terraform.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as consul from "@pulumi/consul";
*
* const myappConfig = new consul.KeyPrefix("myapp_config", {
* datacenter: "nyc1",
* token: "abcd",
* pathPrefix: "myapp/config/",
* subkeys: {
* elb_cname: appAwsElb.dnsName,
* s3_bucket_name: appAwsS3Bucket.bucket,
* "database/hostname": app.address,
* "database/port": app.port,
* "database/username": app.username,
* "database/name": app.name,
* },
* subkeyCollection: [{
* path: "database/password",
* value: app.password,
* flags: 2,
* }],
* });
* ```
*
* ## Import
*
* `consul.KeyPrefix` can be imported. This is useful when the path already exists and
* you know all keys in path should be managed by Terraform.
*
* ```sh
* $ pulumi import consul:index/keyPrefix:KeyPrefix myapp_config myapp/config/
* ```
*/
export declare class KeyPrefix extends pulumi.CustomResource {
/**
* Get an existing KeyPrefix 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: string, id: pulumi.Input<pulumi.ID>, state?: KeyPrefixState, opts?: pulumi.CustomResourceOptions): KeyPrefix;
/**
* Returns true if the given object is an instance of KeyPrefix. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is KeyPrefix;
/**
* The datacenter to use. This overrides the
* agent's default datacenter and the datacenter in the provider setup.
*/
readonly datacenter: pulumi.Output<string>;
/**
* The namespace to create the keys within.
*/
readonly namespace: pulumi.Output<string | undefined>;
/**
* The admin partition to create the keys within.
*/
readonly partition: pulumi.Output<string | undefined>;
/**
* Specifies the common prefix shared by all keys
* that will be managed by this resource instance. In most cases this will
* end with a slash, to manage a "folder" of keys.
*/
readonly pathPrefix: pulumi.Output<string>;
/**
* A subkey to add. Supported values documented below.
* Multiple blocks supported.
*/
readonly subkeyCollection: pulumi.Output<outputs.KeyPrefixSubkeyCollection[] | undefined>;
/**
* A mapping from subkey name (which will be appended
* to the given `pathPrefix`) to the value that should be stored at that key.
* Use slashes, as shown in the above example, to create "sub-folders" under
* the given path prefix.
*/
readonly subkeys: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* The ACL token to use. This overrides the
* token that the agent provides by default.
*
* @deprecated The token argument has been deprecated and will be removed in a future release.
Please use the token argument in the provider configuration
*/
readonly token: pulumi.Output<string | undefined>;
/**
* Create a KeyPrefix resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: KeyPrefixArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering KeyPrefix resources.
*/
export interface KeyPrefixState {
/**
* The datacenter to use. This overrides the
* agent's default datacenter and the datacenter in the provider setup.
*/
datacenter?: pulumi.Input<string>;
/**
* The namespace to create the keys within.
*/
namespace?: pulumi.Input<string>;
/**
* The admin partition to create the keys within.
*/
partition?: pulumi.Input<string>;
/**
* Specifies the common prefix shared by all keys
* that will be managed by this resource instance. In most cases this will
* end with a slash, to manage a "folder" of keys.
*/
pathPrefix?: pulumi.Input<string>;
/**
* A subkey to add. Supported values documented below.
* Multiple blocks supported.
*/
subkeyCollection?: pulumi.Input<pulumi.Input<inputs.KeyPrefixSubkeyCollection>[]>;
/**
* A mapping from subkey name (which will be appended
* to the given `pathPrefix`) to the value that should be stored at that key.
* Use slashes, as shown in the above example, to create "sub-folders" under
* the given path prefix.
*/
subkeys?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The ACL token to use. This overrides the
* token that the agent provides by default.
*
* @deprecated The token argument has been deprecated and will be removed in a future release.
Please use the token argument in the provider configuration
*/
token?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a KeyPrefix resource.
*/
export interface KeyPrefixArgs {
/**
* The datacenter to use. This overrides the
* agent's default datacenter and the datacenter in the provider setup.
*/
datacenter?: pulumi.Input<string>;
/**
* The namespace to create the keys within.
*/
namespace?: pulumi.Input<string>;
/**
* The admin partition to create the keys within.
*/
partition?: pulumi.Input<string>;
/**
* Specifies the common prefix shared by all keys
* that will be managed by this resource instance. In most cases this will
* end with a slash, to manage a "folder" of keys.
*/
pathPrefix: pulumi.Input<string>;
/**
* A subkey to add. Supported values documented below.
* Multiple blocks supported.
*/
subkeyCollection?: pulumi.Input<pulumi.Input<inputs.KeyPrefixSubkeyCollection>[]>;
/**
* A mapping from subkey name (which will be appended
* to the given `pathPrefix`) to the value that should be stored at that key.
* Use slashes, as shown in the above example, to create "sub-folders" under
* the given path prefix.
*/
subkeys?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* The ACL token to use. This overrides the
* token that the agent provides by default.
*
* @deprecated The token argument has been deprecated and will be removed in a future release.
Please use the token argument in the provider configuration
*/
token?: pulumi.Input<string>;
}