UNPKG

@pulumi/consul

Version:

A Pulumi package for creating and managing consul resources.

344 lines 10.8 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigEntry = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * ## 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 * ``` */ 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, id, state, opts) { return new ConfigEntry(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * 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) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ConfigEntry.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["configJson"] = state ? state.configJson : undefined; resourceInputs["kind"] = state ? state.kind : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namespace"] = state ? state.namespace : undefined; resourceInputs["partition"] = state ? state.partition : undefined; } else { const args = argsOrState; if ((!args || args.kind === undefined) && !opts.urn) { throw new Error("Missing required property 'kind'"); } resourceInputs["configJson"] = args ? args.configJson : undefined; resourceInputs["kind"] = args ? args.kind : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namespace"] = args ? args.namespace : undefined; resourceInputs["partition"] = args ? args.partition : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ConfigEntry.__pulumiType, name, resourceInputs, opts); } } exports.ConfigEntry = ConfigEntry; /** @internal */ ConfigEntry.__pulumiType = 'consul:index/configEntry:ConfigEntry'; //# sourceMappingURL=configEntry.js.map