ConfigEntry
The Configuration Entry resource can be used to provide cluster-wide defaults for various aspects of Consul.
Example Usage
using System.Collections.Generic;
using System.Text.Json;
using Pulumi;
using Consul = Pulumi.Consul;
class MyStack : Stack
{
public MyStack()
{
var proxyDefaults = new Consul.ConfigEntry("proxyDefaults", new Consul.ConfigEntryArgs
{
Kind = "proxy-defaults",
ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
{ "Config", new Dictionary<string, object?>
{
{ "local_connect_timeout_ms", 1000 },
{ "handshake_timeout_ms", 10000 },
} },
}),
});
var web = new Consul.ConfigEntry("web", new Consul.ConfigEntryArgs
{
Kind = "service-defaults",
ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
{ "Protocol", "http" },
}),
});
var admin = new Consul.ConfigEntry("admin", new Consul.ConfigEntryArgs
{
Kind = "service-defaults",
ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
{ "Protocol", "http" },
}),
});
var serviceResolver = new Consul.ConfigEntry("serviceResolver", new Consul.ConfigEntryArgs
{
Kind = "service-resolver",
ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
{ "DefaultSubset", "v1" },
{ "Subsets", new Dictionary<string, object?>
{
{ "v1", new Dictionary<string, object?>
{
{ "Filter", "Service.Meta.version == v1" },
} },
{ "v2", new Dictionary<string, object?>
{
{ "Filter", "Service.Meta.version == v2" },
} },
} },
}),
});
var serviceSplitter = new Consul.ConfigEntry("serviceSplitter", new Consul.ConfigEntryArgs
{
Kind = "service-splitter",
ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
{ "Splits", new[]
{
new Dictionary<string, object?>
{
{ "Weight", 90 },
{ "ServiceSubset", "v1" },
},
new Dictionary<string, object?>
{
{ "Weight", 10 },
{ "ServiceSubset", "v2" },
},
}
},
}),
});
var serviceRouter = new Consul.ConfigEntry("serviceRouter", new Consul.ConfigEntryArgs
{
Kind = "service-router",
ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
{
{ "Routes", new[]
{
new Dictionary<string, object?>
{
{ "Match", new Dictionary<string, object?>
{
{ "HTTP", new Dictionary<string, object?>
{
{ "PathPrefix", "/admin" },
} },
} },
{ "Destination", new Dictionary<string, object?>
{
{ "Service", "admin" },
} },
},
}
},
}),
});
}
}
Coming soon!
import pulumi
import json
import pulumi_consul as consul
proxy_defaults = consul.ConfigEntry("proxyDefaults",
kind="proxy-defaults",
config_json=json.dumps({
"Config": {
"local_connect_timeout_ms": 1000,
"handshake_timeout_ms": 10000,
},
}))
web = consul.ConfigEntry("web",
kind="service-defaults",
config_json=json.dumps({
"Protocol": "http",
}))
admin = consul.ConfigEntry("admin",
kind="service-defaults",
config_json=json.dumps({
"Protocol": "http",
}))
service_resolver = consul.ConfigEntry("serviceResolver",
kind="service-resolver",
config_json=json.dumps({
"DefaultSubset": "v1",
"Subsets": {
"v1": {
"Filter": "Service.Meta.version == v1",
},
"v2": {
"Filter": "Service.Meta.version == v2",
},
},
}))
service_splitter = consul.ConfigEntry("serviceSplitter",
kind="service-splitter",
config_json=json.dumps({
"Splits": [
{
"Weight": 90,
"ServiceSubset": "v1",
},
{
"Weight": 10,
"ServiceSubset": "v2",
},
],
}))
service_router = consul.ConfigEntry("serviceRouter",
kind="service-router",
config_json=json.dumps({
"Routes": [{
"Match": {
"HTTP": {
"PathPrefix": "/admin",
},
},
"Destination": {
"Service": "admin",
},
}],
}))import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";
const proxyDefaults = new consul.ConfigEntry("proxyDefaults", {
kind: "proxy-defaults",
configJson: JSON.stringify({
Config: {
local_connect_timeout_ms: 1000,
handshake_timeout_ms: 10000,
},
}),
});
const web = new consul.ConfigEntry("web", {
kind: "service-defaults",
configJson: JSON.stringify({
Protocol: "http",
}),
});
const admin = new consul.ConfigEntry("admin", {
kind: "service-defaults",
configJson: JSON.stringify({
Protocol: "http",
}),
});
const serviceResolver = new consul.ConfigEntry("serviceResolver", {
kind: "service-resolver",
configJson: JSON.stringify({
DefaultSubset: "v1",
Subsets: {
v1: {
Filter: "Service.Meta.version == v1",
},
v2: {
Filter: "Service.Meta.version == v2",
},
},
}),
});
const serviceSplitter = new consul.ConfigEntry("serviceSplitter", {
kind: "service-splitter",
configJson: JSON.stringify({
Splits: [
{
Weight: 90,
ServiceSubset: "v1",
},
{
Weight: 10,
ServiceSubset: "v2",
},
],
}),
});
const serviceRouter = new consul.ConfigEntry("serviceRouter", {
kind: "service-router",
configJson: JSON.stringify({
Routes: [{
Match: {
HTTP: {
PathPrefix: "/admin",
},
},
Destination: {
Service: "admin",
},
}],
}),
});Create a ConfigEntry Resource
new ConfigEntry(name: string, args: ConfigEntryArgs, opts?: CustomResourceOptions);def ConfigEntry(resource_name, opts=None, config_json=None, kind=None, name=None, __props__=None);func NewConfigEntry(ctx *Context, name string, args ConfigEntryArgs, opts ...ResourceOption) (*ConfigEntry, error)public ConfigEntry(string name, ConfigEntryArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args ConfigEntryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ConfigEntryArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConfigEntryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
ConfigEntry Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The ConfigEntry resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ConfigEntry resource produces the following output properties:
Look up an Existing ConfigEntry Resource
Get an existing ConfigEntry resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ConfigEntryState, opts?: CustomResourceOptions): ConfigEntrystatic get(resource_name, id, opts=None, config_json=None, kind=None, name=None, __props__=None);func GetConfigEntry(ctx *Context, name string, id IDInput, state *ConfigEntryState, opts ...ResourceOption) (*ConfigEntry, error)public static ConfigEntry Get(string name, Input<string> id, ConfigEntryState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
Package Details
- Repository
- https://github.com/pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consulTerraform Provider.