@pulumi/consul
Version:
A Pulumi package for creating and managing consul resources.
381 lines (380 loc) • 11.2 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as consul from "@pulumi/consul";
*
* const proxyDefaults = new consul.ConfigEntry("proxy_defaults", {
* kind: "proxy-defaults",
* name: "global",
* configJson: JSON.stringify({
* Config: {
* local_connect_timeout_ms: 1000,
* handshake_timeout_ms: 10000,
* },
* }),
* });
* const web = new consul.ConfigEntry("web", {
* name: "web",
* kind: "service-defaults",
* configJson: JSON.stringify({
* Protocol: "http",
* }),
* });
* const admin = new consul.ConfigEntry("admin", {
* name: "admin",
* kind: "service-defaults",
* configJson: JSON.stringify({
* Protocol: "http",
* }),
* });
* const serviceResolver = new consul.ConfigEntry("service_resolver", {
* kind: "service-resolver",
* name: web.name,
* configJson: JSON.stringify({
* DefaultSubset: "v1",
* Subsets: {
* v1: {
* Filter: "Service.Meta.version == v1",
* },
* v2: {
* Filter: "Service.Meta.version == v2",
* },
* },
* }),
* });
* const serviceSplitter = new consul.ConfigEntry("service_splitter", {
* kind: "service-splitter",
* name: serviceResolver.name,
* configJson: JSON.stringify({
* Splits: [
* {
* Weight: 90,
* ServiceSubset: "v1",
* },
* {
* Weight: 10,
* ServiceSubset: "v2",
* },
* ],
* }),
* });
* const serviceRouter = new consul.ConfigEntry("service_router", {
* kind: "service-router",
* name: "web",
* configJson: JSON.stringify({
* Routes: [{
* Match: {
* HTTP: {
* PathPrefix: "/admin",
* },
* },
* Destination: {
* Service: "admin",
* },
* }],
* }),
* });
* const ingressGateway = new consul.ConfigEntry("ingress_gateway", {
* name: "us-east-ingress",
* kind: "ingress-gateway",
* configJson: JSON.stringify({
* TLS: {
* Enabled: true,
* },
* Listeners: [{
* Port: 8000,
* Protocol: "http",
* Services: [{
* Name: "*",
* }],
* }],
* }),
* });
* const terminatingGateway = new consul.ConfigEntry("terminating_gateway", {
* name: "us-west-gateway",
* kind: "terminating-gateway",
* configJson: JSON.stringify({
* Services: [{
* Name: "billing",
* }],
* }),
* });
* ```
*
* ### `service-intentions` config entry
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as consul from "@pulumi/consul";
*
* const serviceIntentions = new consul.ConfigEntry("service_intentions", {
* name: "api-service",
* kind: "service-intentions",
* configJson: JSON.stringify({
* Sources: [
* {
* Action: "allow",
* Name: "frontend-webapp",
* Precedence: 9,
* Type: "consul",
* },
* {
* Action: "allow",
* Name: "nightly-cronjob",
* Precedence: 9,
* Type: "consul",
* },
* ],
* }),
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as consul from "@pulumi/consul";
*
* const sd = new consul.ConfigEntry("sd", {
* name: "fort-knox",
* kind: "service-defaults",
* configJson: JSON.stringify({
* Protocol: "http",
* }),
* });
* const jwtProvider = new consul.ConfigEntry("jwt_provider", {
* name: "test-provider",
* kind: "jwt-provider",
* configJson: JSON.stringify({
* Issuer: "test-issuer",
* JSONWebKeySet: {
* Remote: {
* URI: "https://127.0.0.1:9091",
* FetchAsynchronously: true,
* },
* },
* Forwarding: {
* HeaderName: "test-token",
* },
* }),
* });
* const serviceIntentions = new consul.ConfigEntry("service_intentions", {
* name: sd.name,
* kind: "service-intentions",
* configJson: pulumi.jsonStringify({
* Sources: [
* {
* Name: "contractor-webapp",
* Permissions: [{
* Action: "allow",
* HTTP: {
* Methods: [
* "GET",
* "HEAD",
* ],
* PathExact: "/healtz",
* },
* JWT: {
* Providers: [{
* Name: jwtProvider.name,
* }],
* },
* }],
* Precedence: 9,
* Type: "consul",
* },
* {
* Name: "admin-dashboard-webapp",
* Permissions: [
* {
* Action: "deny",
* HTTP: {
* PathPrefix: "/debugz",
* },
* },
* {
* Action: "allow",
* HTTP: {
* PathPrefix: "/",
* },
* },
* ],
* Precedence: 9,
* Type: "consul",
* },
* ],
* }),
* });
* ```
*
* ### `exported-services` config entry
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as consul from "@pulumi/consul";
*
* const exportedServices = new consul.ConfigEntry("exported_services", {
* name: "test",
* kind: "exported-services",
* configJson: JSON.stringify({
* Services: [{
* Name: "test",
* Namespace: "default",
* Consumers: [{
* Partition: "default",
* }],
* }],
* }),
* });
* ```
*
* ### `mesh` config entry
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as consul from "@pulumi/consul";
*
* const mesh = new consul.ConfigEntry("mesh", {
* name: "mesh",
* kind: "mesh",
* partition: "default",
* configJson: JSON.stringify({
* TransparentProxy: {
* MeshDestinationsOnly: true,
* },
* }),
* });
* ```
*
* ### `jwt-provider` config entry
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as consul from "@pulumi/consul";
*
* const jwtProvider = new consul.ConfigEntry("jwt_provider", {
* name: "provider-name",
* kind: "jwt-provider",
* configJson: JSON.stringify({
* Issuer: "https://your.issuer.com",
* JSONWebKeySet: {
* Remote: {
* URI: "https://your-remote.jwks.com",
* FetchAsynchronously: true,
* CacheDuration: "10s",
* },
* },
* Forwarding: {
* HeaderName: "test-token",
* },
* }),
* });
* ```
*
* ## Import
*
* `consul_config_entry` can be imported using the syntax `<kind>/<name>` if the
* config entry is in the default partition and default namespace, or
* `<partition>/<namespace>/<kind>/<name>` for config entries in a non-default
* partition or namespace:
*
* ```sh
* $ pulumi import consul:index/configEntry:ConfigEntry service_splitter 816a195f-6cb1-2e8d-92af-3011ae706318
* ```
*/
export declare class ConfigEntry extends pulumi.CustomResource {
/**
* Get an existing ConfigEntry 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?: ConfigEntryState, opts?: pulumi.CustomResourceOptions): ConfigEntry;
/**
* Returns true if the given object is an instance of ConfigEntry. 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 ConfigEntry;
/**
* An arbitrary map of configuration values.
*/
readonly configJson: pulumi.Output<string | undefined>;
/**
* The kind of configuration entry to register.
*/
readonly kind: pulumi.Output<string>;
/**
* The name of the configuration entry being registered.
*/
readonly name: pulumi.Output<string>;
/**
* The namespace to create the config entry within.
*/
readonly namespace: pulumi.Output<string | undefined>;
/**
* The partition the config entry is associated with.
*/
readonly partition: pulumi.Output<string | undefined>;
/**
* Create a ConfigEntry 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: ConfigEntryArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering ConfigEntry resources.
*/
export interface ConfigEntryState {
/**
* An arbitrary map of configuration values.
*/
configJson?: pulumi.Input<string>;
/**
* The kind of configuration entry to register.
*/
kind?: pulumi.Input<string>;
/**
* The name of the configuration entry being registered.
*/
name?: pulumi.Input<string>;
/**
* The namespace to create the config entry within.
*/
namespace?: pulumi.Input<string>;
/**
* The partition the config entry is associated with.
*/
partition?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a ConfigEntry resource.
*/
export interface ConfigEntryArgs {
/**
* An arbitrary map of configuration values.
*/
configJson?: pulumi.Input<string>;
/**
* The kind of configuration entry to register.
*/
kind: pulumi.Input<string>;
/**
* The name of the configuration entry being registered.
*/
name?: pulumi.Input<string>;
/**
* The namespace to create the config entry within.
*/
namespace?: pulumi.Input<string>;
/**
* The partition the config entry is associated with.
*/
partition?: pulumi.Input<string>;
}