@pulumi/consul
Version:
A Pulumi package for creating and managing consul resources.
107 lines (106 loc) • 3.34 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
/**
* 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",
* },
* }));
* }
* }
* ```
*/
export declare function getDatacenters(opts?: pulumi.InvokeOptions): Promise<GetDatacentersResult>;
/**
* A collection of values returned by getDatacenters.
*/
export interface GetDatacentersResult {
/**
* The list of datacenters known. The datacenters will be sorted
* in ascending order based on the estimated median round trip time from the server
* to the servers in that datacenter.
*/
readonly datacenters: string[];
/**
* The provider-assigned unique ID for this managed resource.
*/
readonly id: string;
}
/**
* 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",
* },
* }));
* }
* }
* ```
*/
export declare function getDatacentersOutput(opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetDatacentersResult>;