UNPKG

@pulumi/consul

Version:

A Pulumi package for creating and managing consul resources.

106 lines 3.54 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.getDatacentersOutput = exports.getDatacenters = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * The `consul.getDatacenters` data source returns the list of all knwown Consul * datacenters. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as consul from "@pulumi/consul"; * import * as std from "@pulumi/std"; * * export = async () => { * const all = await consul.getDatacenters({}); * // Register a prepared query in each of the datacenters * const myapp_query: consul.PreparedQuery[] = []; * for (const range of std.toset({ * input: all.datacenters, * }).result.map((v, k) => ({key: k, value: v}))) { * myapp_query.push(new consul.PreparedQuery(`myapp-query-${range.key}`, { * name: "myquery", * datacenter: range.key, * onlyPassing: true, * near: "_agent", * service: "myapp", * tags: [ * "active", * "!standby", * ], * failover: { * nearestN: 3, * datacenters: [ * "us-west1", * "us-east-2", * "asia-east1", * ], * }, * dns: { * ttl: "30s", * }, * })); * } * } * ``` */ function getDatacenters(opts) { opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invoke("consul:index/getDatacenters:getDatacenters", {}, opts); } exports.getDatacenters = getDatacenters; /** * The `consul.getDatacenters` data source returns the list of all knwown Consul * datacenters. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as consul from "@pulumi/consul"; * import * as std from "@pulumi/std"; * * export = async () => { * const all = await consul.getDatacenters({}); * // Register a prepared query in each of the datacenters * const myapp_query: consul.PreparedQuery[] = []; * for (const range of std.toset({ * input: all.datacenters, * }).result.map((v, k) => ({key: k, value: v}))) { * myapp_query.push(new consul.PreparedQuery(`myapp-query-${range.key}`, { * name: "myquery", * datacenter: range.key, * onlyPassing: true, * near: "_agent", * service: "myapp", * tags: [ * "active", * "!standby", * ], * failover: { * nearestN: 3, * datacenters: [ * "us-west1", * "us-east-2", * "asia-east1", * ], * }, * dns: { * ttl: "30s", * }, * })); * } * } * ``` */ function getDatacentersOutput(opts) { opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {}); return pulumi.runtime.invokeOutput("consul:index/getDatacenters:getDatacenters", {}, opts); } exports.getDatacentersOutput = getDatacentersOutput; //# sourceMappingURL=getDatacenters.js.map