Show / Hide Table of Contents

Class 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" },
                        } },
                    },
                }
             },
        }),
    });
}

}
Inheritance
System.Object
Resource
CustomResource
ConfigEntry
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Consul
Assembly: Pulumi.Consul.dll
Syntax
public class ConfigEntry : CustomResource

Constructors

View Source

ConfigEntry(String, ConfigEntryArgs, CustomResourceOptions)

Create a ConfigEntry resource with the given unique name, arguments, and options.

Declaration
public ConfigEntry(string name, ConfigEntryArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

ConfigEntryArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

ConfigJson

An arbitrary map of configuration values.

Declaration
public Output<string> ConfigJson { get; }
Property Value
Type Description
Output<System.String>
View Source

Kind

The kind of configuration entry to register.

Declaration
public Output<string> Kind { get; }
Property Value
Type Description
Output<System.String>
View Source

Name

The name of the configuration entry being registred.

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, ConfigEntryState, CustomResourceOptions)

Get an existing ConfigEntry resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static ConfigEntry Get(string name, Input<string> id, ConfigEntryState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

ConfigEntryState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
ConfigEntry
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.