1. Packages
  2. HashiCorp Consul
  3. API Docs
  4. Service
Consul v3.11.3 published on Friday, May 24, 2024 by Pulumi

consul.Service

Explore with Pulumi AI

consul logo
Consul v3.11.3 published on Friday, May 24, 2024 by Pulumi

    A high-level resource for creating a Service in Consul in the Consul catalog. This is appropriate for registering external services and can be used to create services addressable by Consul that cannot be registered with a local agent.

    NOTE: If a Consul agent is running on the node where this service is registered, it is not recommended to use this resource as the service will be removed during the next anti-entropy synchronization.

    Example Usage

    Creating a new node with the service:

    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    const compute = new consul.Node("compute", {
        name: "compute-google",
        address: "www.google.com",
    });
    const google = new consul.Service("google", {
        name: "google",
        node: compute.name,
        port: 80,
        tags: ["tag0"],
    });
    
    import pulumi
    import pulumi_consul as consul
    
    compute = consul.Node("compute",
        name="compute-google",
        address="www.google.com")
    google = consul.Service("google",
        name="google",
        node=compute.name,
        port=80,
        tags=["tag0"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-consul/sdk/v3/go/consul"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		compute, err := consul.NewNode(ctx, "compute", &consul.NodeArgs{
    			Name:    pulumi.String("compute-google"),
    			Address: pulumi.String("www.google.com"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = consul.NewService(ctx, "google", &consul.ServiceArgs{
    			Name: pulumi.String("google"),
    			Node: compute.Name,
    			Port: pulumi.Int(80),
    			Tags: pulumi.StringArray{
    				pulumi.String("tag0"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        var compute = new Consul.Node("compute", new()
        {
            Name = "compute-google",
            Address = "www.google.com",
        });
    
        var google = new Consul.Service("google", new()
        {
            Name = "google",
            Node = compute.Name,
            Port = 80,
            Tags = new[]
            {
                "tag0",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.consul.Node;
    import com.pulumi.consul.NodeArgs;
    import com.pulumi.consul.Service;
    import com.pulumi.consul.ServiceArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var compute = new Node("compute", NodeArgs.builder()
                .name("compute-google")
                .address("www.google.com")
                .build());
    
            var google = new Service("google", ServiceArgs.builder()
                .name("google")
                .node(compute.name())
                .port(80)
                .tags("tag0")
                .build());
    
        }
    }
    
    resources:
      google:
        type: consul:Service
        properties:
          name: google
          node: ${compute.name}
          port: 80
          tags:
            - tag0
      compute:
        type: consul:Node
        properties:
          name: compute-google
          address: www.google.com
    

    Utilizing an existing known node:

    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    const google = new consul.Service("google", {
        name: "google",
        node: "google",
        port: 443,
    });
    
    import pulumi
    import pulumi_consul as consul
    
    google = consul.Service("google",
        name="google",
        node="google",
        port=443)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-consul/sdk/v3/go/consul"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := consul.NewService(ctx, "google", &consul.ServiceArgs{
    			Name: pulumi.String("google"),
    			Node: pulumi.String("google"),
    			Port: pulumi.Int(443),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        var google = new Consul.Service("google", new()
        {
            Name = "google",
            Node = "google",
            Port = 443,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.consul.Service;
    import com.pulumi.consul.ServiceArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var google = new Service("google", ServiceArgs.builder()
                .name("google")
                .node("google")
                .port(443)
                .build());
    
        }
    }
    
    resources:
      google:
        type: consul:Service
        properties:
          name: google
          node: google
          port: 443
    

    Register a health-check:

    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    const redis = new consul.Service("redis", {
        name: "redis",
        node: "redis",
        port: 6379,
        checks: [{
            checkId: "service:redis1",
            name: "Redis health check",
            status: "passing",
            http: "https://www.hashicorptest.com",
            tlsSkipVerify: false,
            method: "PUT",
            interval: "5s",
            timeout: "1s",
            deregisterCriticalServiceAfter: "30s",
            headers: [
                {
                    name: "foo",
                    values: ["test"],
                },
                {
                    name: "bar",
                    values: ["test"],
                },
            ],
        }],
    });
    
    import pulumi
    import pulumi_consul as consul
    
    redis = consul.Service("redis",
        name="redis",
        node="redis",
        port=6379,
        checks=[consul.ServiceCheckArgs(
            check_id="service:redis1",
            name="Redis health check",
            status="passing",
            http="https://www.hashicorptest.com",
            tls_skip_verify=False,
            method="PUT",
            interval="5s",
            timeout="1s",
            deregister_critical_service_after="30s",
            headers=[
                consul.ServiceCheckHeaderArgs(
                    name="foo",
                    values=["test"],
                ),
                consul.ServiceCheckHeaderArgs(
                    name="bar",
                    values=["test"],
                ),
            ],
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-consul/sdk/v3/go/consul"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := consul.NewService(ctx, "redis", &consul.ServiceArgs{
    			Name: pulumi.String("redis"),
    			Node: pulumi.String("redis"),
    			Port: pulumi.Int(6379),
    			Checks: consul.ServiceCheckArray{
    				&consul.ServiceCheckArgs{
    					CheckId:                        pulumi.String("service:redis1"),
    					Name:                           pulumi.String("Redis health check"),
    					Status:                         pulumi.String("passing"),
    					Http:                           pulumi.String("https://www.hashicorptest.com"),
    					TlsSkipVerify:                  pulumi.Bool(false),
    					Method:                         pulumi.String("PUT"),
    					Interval:                       pulumi.String("5s"),
    					Timeout:                        pulumi.String("1s"),
    					DeregisterCriticalServiceAfter: pulumi.String("30s"),
    					Headers: consul.ServiceCheckHeaderArray{
    						&consul.ServiceCheckHeaderArgs{
    							Name: pulumi.String("foo"),
    							Values: pulumi.StringArray{
    								pulumi.String("test"),
    							},
    						},
    						&consul.ServiceCheckHeaderArgs{
    							Name: pulumi.String("bar"),
    							Values: pulumi.StringArray{
    								pulumi.String("test"),
    							},
    						},
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        var redis = new Consul.Service("redis", new()
        {
            Name = "redis",
            Node = "redis",
            Port = 6379,
            Checks = new[]
            {
                new Consul.Inputs.ServiceCheckArgs
                {
                    CheckId = "service:redis1",
                    Name = "Redis health check",
                    Status = "passing",
                    Http = "https://www.hashicorptest.com",
                    TlsSkipVerify = false,
                    Method = "PUT",
                    Interval = "5s",
                    Timeout = "1s",
                    DeregisterCriticalServiceAfter = "30s",
                    Headers = new[]
                    {
                        new Consul.Inputs.ServiceCheckHeaderArgs
                        {
                            Name = "foo",
                            Values = new[]
                            {
                                "test",
                            },
                        },
                        new Consul.Inputs.ServiceCheckHeaderArgs
                        {
                            Name = "bar",
                            Values = new[]
                            {
                                "test",
                            },
                        },
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.consul.Service;
    import com.pulumi.consul.ServiceArgs;
    import com.pulumi.consul.inputs.ServiceCheckArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var redis = new Service("redis", ServiceArgs.builder()
                .name("redis")
                .node("redis")
                .port(6379)
                .checks(ServiceCheckArgs.builder()
                    .checkId("service:redis1")
                    .name("Redis health check")
                    .status("passing")
                    .http("https://www.hashicorptest.com")
                    .tlsSkipVerify(false)
                    .method("PUT")
                    .interval("5s")
                    .timeout("1s")
                    .deregisterCriticalServiceAfter("30s")
                    .headers(                
                        ServiceCheckHeaderArgs.builder()
                            .name("foo")
                            .values("test")
                            .build(),
                        ServiceCheckHeaderArgs.builder()
                            .name("bar")
                            .values("test")
                            .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      redis:
        type: consul:Service
        properties:
          name: redis
          node: redis
          port: 6379
          checks:
            - checkId: service:redis1
              name: Redis health check
              status: passing
              http: https://www.hashicorptest.com
              tlsSkipVerify: false
              method: PUT
              interval: 5s
              timeout: 1s
              deregisterCriticalServiceAfter: 30s
              headers:
                - name: foo
                  values:
                    - test
                - name: bar
                  values:
                    - test
    

    Create Service Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Service(name: string, args: ServiceArgs, opts?: CustomResourceOptions);
    @overload
    def Service(resource_name: str,
                args: ServiceArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def Service(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                node: Optional[str] = None,
                name: Optional[str] = None,
                datacenter: Optional[str] = None,
                enable_tag_override: Optional[bool] = None,
                external: Optional[bool] = None,
                meta: Optional[Mapping[str, str]] = None,
                address: Optional[str] = None,
                namespace: Optional[str] = None,
                checks: Optional[Sequence[ServiceCheckArgs]] = None,
                partition: Optional[str] = None,
                port: Optional[int] = None,
                service_id: Optional[str] = None,
                tags: Optional[Sequence[str]] = None)
    func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
    public Service(string name, ServiceArgs args, CustomResourceOptions? opts = null)
    public Service(String name, ServiceArgs args)
    public Service(String name, ServiceArgs args, CustomResourceOptions options)
    
    type: consul:Service
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var serviceResource = new Consul.Service("serviceResource", new()
    {
        Node = "string",
        Name = "string",
        Datacenter = "string",
        EnableTagOverride = false,
        Meta = 
        {
            { "string", "string" },
        },
        Address = "string",
        Namespace = "string",
        Checks = new[]
        {
            new Consul.Inputs.ServiceCheckArgs
            {
                CheckId = "string",
                Interval = "string",
                Name = "string",
                Timeout = "string",
                DeregisterCriticalServiceAfter = "string",
                Headers = new[]
                {
                    new Consul.Inputs.ServiceCheckHeaderArgs
                    {
                        Name = "string",
                        Values = new[]
                        {
                            "string",
                        },
                    },
                },
                Http = "string",
                Method = "string",
                Notes = "string",
                Status = "string",
                Tcp = "string",
                TlsSkipVerify = false,
            },
        },
        Partition = "string",
        Port = 0,
        ServiceId = "string",
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := consul.NewService(ctx, "serviceResource", &consul.ServiceArgs{
    	Node:              pulumi.String("string"),
    	Name:              pulumi.String("string"),
    	Datacenter:        pulumi.String("string"),
    	EnableTagOverride: pulumi.Bool(false),
    	Meta: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Address:   pulumi.String("string"),
    	Namespace: pulumi.String("string"),
    	Checks: consul.ServiceCheckArray{
    		&consul.ServiceCheckArgs{
    			CheckId:                        pulumi.String("string"),
    			Interval:                       pulumi.String("string"),
    			Name:                           pulumi.String("string"),
    			Timeout:                        pulumi.String("string"),
    			DeregisterCriticalServiceAfter: pulumi.String("string"),
    			Headers: consul.ServiceCheckHeaderArray{
    				&consul.ServiceCheckHeaderArgs{
    					Name: pulumi.String("string"),
    					Values: pulumi.StringArray{
    						pulumi.String("string"),
    					},
    				},
    			},
    			Http:          pulumi.String("string"),
    			Method:        pulumi.String("string"),
    			Notes:         pulumi.String("string"),
    			Status:        pulumi.String("string"),
    			Tcp:           pulumi.String("string"),
    			TlsSkipVerify: pulumi.Bool(false),
    		},
    	},
    	Partition: pulumi.String("string"),
    	Port:      pulumi.Int(0),
    	ServiceId: pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var serviceResource = new Service("serviceResource", ServiceArgs.builder()
        .node("string")
        .name("string")
        .datacenter("string")
        .enableTagOverride(false)
        .meta(Map.of("string", "string"))
        .address("string")
        .namespace("string")
        .checks(ServiceCheckArgs.builder()
            .checkId("string")
            .interval("string")
            .name("string")
            .timeout("string")
            .deregisterCriticalServiceAfter("string")
            .headers(ServiceCheckHeaderArgs.builder()
                .name("string")
                .values("string")
                .build())
            .http("string")
            .method("string")
            .notes("string")
            .status("string")
            .tcp("string")
            .tlsSkipVerify(false)
            .build())
        .partition("string")
        .port(0)
        .serviceId("string")
        .tags("string")
        .build());
    
    service_resource = consul.Service("serviceResource",
        node="string",
        name="string",
        datacenter="string",
        enable_tag_override=False,
        meta={
            "string": "string",
        },
        address="string",
        namespace="string",
        checks=[consul.ServiceCheckArgs(
            check_id="string",
            interval="string",
            name="string",
            timeout="string",
            deregister_critical_service_after="string",
            headers=[consul.ServiceCheckHeaderArgs(
                name="string",
                values=["string"],
            )],
            http="string",
            method="string",
            notes="string",
            status="string",
            tcp="string",
            tls_skip_verify=False,
        )],
        partition="string",
        port=0,
        service_id="string",
        tags=["string"])
    
    const serviceResource = new consul.Service("serviceResource", {
        node: "string",
        name: "string",
        datacenter: "string",
        enableTagOverride: false,
        meta: {
            string: "string",
        },
        address: "string",
        namespace: "string",
        checks: [{
            checkId: "string",
            interval: "string",
            name: "string",
            timeout: "string",
            deregisterCriticalServiceAfter: "string",
            headers: [{
                name: "string",
                values: ["string"],
            }],
            http: "string",
            method: "string",
            notes: "string",
            status: "string",
            tcp: "string",
            tlsSkipVerify: false,
        }],
        partition: "string",
        port: 0,
        serviceId: "string",
        tags: ["string"],
    });
    
    type: consul:Service
    properties:
        address: string
        checks:
            - checkId: string
              deregisterCriticalServiceAfter: string
              headers:
                - name: string
                  values:
                    - string
              http: string
              interval: string
              method: string
              name: string
              notes: string
              status: string
              tcp: string
              timeout: string
              tlsSkipVerify: false
        datacenter: string
        enableTagOverride: false
        meta:
            string: string
        name: string
        namespace: string
        node: string
        partition: string
        port: 0
        serviceId: string
        tags:
            - string
    

    Service Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Service resource accepts the following input properties:

    Node string
    The name of the node the to register the service on.
    Address string
    The address of the service. Defaults to the address of the node.
    Checks List<ServiceCheck>
    Datacenter string
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    EnableTagOverride bool
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    External bool

    Deprecated: The external field has been deprecated and does nothing.

    Meta Dictionary<string, string>
    A map of arbitrary KV metadata linked to the service instance.
    Name string
    The name of the service.
    Namespace string
    The namespace to create the service within.
    Partition string
    The partition the service is associated with.
    Port int
    The port of the service.
    ServiceId string
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    Tags List<string>
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    Node string
    The name of the node the to register the service on.
    Address string
    The address of the service. Defaults to the address of the node.
    Checks []ServiceCheckArgs
    Datacenter string
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    EnableTagOverride bool
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    External bool

    Deprecated: The external field has been deprecated and does nothing.

    Meta map[string]string
    A map of arbitrary KV metadata linked to the service instance.
    Name string
    The name of the service.
    Namespace string
    The namespace to create the service within.
    Partition string
    The partition the service is associated with.
    Port int
    The port of the service.
    ServiceId string
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    Tags []string
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    node String
    The name of the node the to register the service on.
    address String
    The address of the service. Defaults to the address of the node.
    checks List<ServiceCheck>
    datacenter String
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enableTagOverride Boolean
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external Boolean

    Deprecated: The external field has been deprecated and does nothing.

    meta Map<String,String>
    A map of arbitrary KV metadata linked to the service instance.
    name String
    The name of the service.
    namespace String
    The namespace to create the service within.
    partition String
    The partition the service is associated with.
    port Integer
    The port of the service.
    serviceId String
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags List<String>
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    node string
    The name of the node the to register the service on.
    address string
    The address of the service. Defaults to the address of the node.
    checks ServiceCheck[]
    datacenter string
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enableTagOverride boolean
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external boolean

    Deprecated: The external field has been deprecated and does nothing.

    meta {[key: string]: string}
    A map of arbitrary KV metadata linked to the service instance.
    name string
    The name of the service.
    namespace string
    The namespace to create the service within.
    partition string
    The partition the service is associated with.
    port number
    The port of the service.
    serviceId string
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags string[]
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    node str
    The name of the node the to register the service on.
    address str
    The address of the service. Defaults to the address of the node.
    checks Sequence[ServiceCheckArgs]
    datacenter str
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enable_tag_override bool
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external bool

    Deprecated: The external field has been deprecated and does nothing.

    meta Mapping[str, str]
    A map of arbitrary KV metadata linked to the service instance.
    name str
    The name of the service.
    namespace str
    The namespace to create the service within.
    partition str
    The partition the service is associated with.
    port int
    The port of the service.
    service_id str
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags Sequence[str]
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    node String
    The name of the node the to register the service on.
    address String
    The address of the service. Defaults to the address of the node.
    checks List<Property Map>
    datacenter String
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enableTagOverride Boolean
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external Boolean

    Deprecated: The external field has been deprecated and does nothing.

    meta Map<String>
    A map of arbitrary KV metadata linked to the service instance.
    name String
    The name of the service.
    namespace String
    The namespace to create the service within.
    partition String
    The partition the service is associated with.
    port Number
    The port of the service.
    serviceId String
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags List<String>
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Service resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Service Resource

    Get an existing Service 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?: ServiceState, opts?: CustomResourceOptions): Service
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            address: Optional[str] = None,
            checks: Optional[Sequence[ServiceCheckArgs]] = None,
            datacenter: Optional[str] = None,
            enable_tag_override: Optional[bool] = None,
            external: Optional[bool] = None,
            meta: Optional[Mapping[str, str]] = None,
            name: Optional[str] = None,
            namespace: Optional[str] = None,
            node: Optional[str] = None,
            partition: Optional[str] = None,
            port: Optional[int] = None,
            service_id: Optional[str] = None,
            tags: Optional[Sequence[str]] = None) -> Service
    func GetService(ctx *Context, name string, id IDInput, state *ServiceState, opts ...ResourceOption) (*Service, error)
    public static Service Get(string name, Input<string> id, ServiceState? state, CustomResourceOptions? opts = null)
    public static Service get(String name, Output<String> id, ServiceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    Address string
    The address of the service. Defaults to the address of the node.
    Checks List<ServiceCheck>
    Datacenter string
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    EnableTagOverride bool
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    External bool

    Deprecated: The external field has been deprecated and does nothing.

    Meta Dictionary<string, string>
    A map of arbitrary KV metadata linked to the service instance.
    Name string
    The name of the service.
    Namespace string
    The namespace to create the service within.
    Node string
    The name of the node the to register the service on.
    Partition string
    The partition the service is associated with.
    Port int
    The port of the service.
    ServiceId string
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    Tags List<string>
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    Address string
    The address of the service. Defaults to the address of the node.
    Checks []ServiceCheckArgs
    Datacenter string
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    EnableTagOverride bool
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    External bool

    Deprecated: The external field has been deprecated and does nothing.

    Meta map[string]string
    A map of arbitrary KV metadata linked to the service instance.
    Name string
    The name of the service.
    Namespace string
    The namespace to create the service within.
    Node string
    The name of the node the to register the service on.
    Partition string
    The partition the service is associated with.
    Port int
    The port of the service.
    ServiceId string
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    Tags []string
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    address String
    The address of the service. Defaults to the address of the node.
    checks List<ServiceCheck>
    datacenter String
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enableTagOverride Boolean
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external Boolean

    Deprecated: The external field has been deprecated and does nothing.

    meta Map<String,String>
    A map of arbitrary KV metadata linked to the service instance.
    name String
    The name of the service.
    namespace String
    The namespace to create the service within.
    node String
    The name of the node the to register the service on.
    partition String
    The partition the service is associated with.
    port Integer
    The port of the service.
    serviceId String
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags List<String>
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    address string
    The address of the service. Defaults to the address of the node.
    checks ServiceCheck[]
    datacenter string
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enableTagOverride boolean
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external boolean

    Deprecated: The external field has been deprecated and does nothing.

    meta {[key: string]: string}
    A map of arbitrary KV metadata linked to the service instance.
    name string
    The name of the service.
    namespace string
    The namespace to create the service within.
    node string
    The name of the node the to register the service on.
    partition string
    The partition the service is associated with.
    port number
    The port of the service.
    serviceId string
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags string[]
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    address str
    The address of the service. Defaults to the address of the node.
    checks Sequence[ServiceCheckArgs]
    datacenter str
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enable_tag_override bool
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external bool

    Deprecated: The external field has been deprecated and does nothing.

    meta Mapping[str, str]
    A map of arbitrary KV metadata linked to the service instance.
    name str
    The name of the service.
    namespace str
    The namespace to create the service within.
    node str
    The name of the node the to register the service on.
    partition str
    The partition the service is associated with.
    port int
    The port of the service.
    service_id str
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags Sequence[str]
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
    address String
    The address of the service. Defaults to the address of the node.
    checks List<Property Map>
    datacenter String
    The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
    enableTagOverride Boolean
    Specifies to disable the anti-entropy feature for this service's tags. Defaults to false.
    external Boolean

    Deprecated: The external field has been deprecated and does nothing.

    meta Map<String>
    A map of arbitrary KV metadata linked to the service instance.
    name String
    The name of the service.
    namespace String
    The namespace to create the service within.
    node String
    The name of the node the to register the service on.
    partition String
    The partition the service is associated with.
    port Number
    The port of the service.
    serviceId String
    If the service ID is not provided, it will be defaulted to the value of the name attribute.
    tags List<String>
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.

    Supporting Types

    ServiceCheck, ServiceCheckArgs

    CheckId string
    An ID, unique per agent.
    Interval string
    The interval to wait between each health-check invocation.
    Name string
    The name of the health-check.
    Timeout string
    Specifies a timeout for outgoing connections in the case of a HTTP or TCP check.
    DeregisterCriticalServiceAfter string
    The time after which the service is automatically deregistered when in the critical state. Defaults to 30s.
    Headers List<ServiceCheckHeader>
    The headers to send for an HTTP check. The attributes of each header is given below.
    Http string
    The HTTP endpoint to call for an HTTP check.
    Method string
    The method to use for HTTP health-checks. Defaults to GET.
    Notes string
    An opaque field meant to hold human readable text.
    Status string
    The initial health-check status.
    Tcp string
    The TCP address and port to connect to for a TCP check.
    TlsSkipVerify bool
    Whether to deactivate certificate verification for HTTP health-checks. Defaults to false.
    CheckId string
    An ID, unique per agent.
    Interval string
    The interval to wait between each health-check invocation.
    Name string
    The name of the health-check.
    Timeout string
    Specifies a timeout for outgoing connections in the case of a HTTP or TCP check.
    DeregisterCriticalServiceAfter string
    The time after which the service is automatically deregistered when in the critical state. Defaults to 30s.
    Headers []ServiceCheckHeader
    The headers to send for an HTTP check. The attributes of each header is given below.
    Http string
    The HTTP endpoint to call for an HTTP check.
    Method string
    The method to use for HTTP health-checks. Defaults to GET.
    Notes string
    An opaque field meant to hold human readable text.
    Status string
    The initial health-check status.
    Tcp string
    The TCP address and port to connect to for a TCP check.
    TlsSkipVerify bool
    Whether to deactivate certificate verification for HTTP health-checks. Defaults to false.
    checkId String
    An ID, unique per agent.
    interval String
    The interval to wait between each health-check invocation.
    name String
    The name of the health-check.
    timeout String
    Specifies a timeout for outgoing connections in the case of a HTTP or TCP check.
    deregisterCriticalServiceAfter String
    The time after which the service is automatically deregistered when in the critical state. Defaults to 30s.
    headers List<ServiceCheckHeader>
    The headers to send for an HTTP check. The attributes of each header is given below.
    http String
    The HTTP endpoint to call for an HTTP check.
    method String
    The method to use for HTTP health-checks. Defaults to GET.
    notes String
    An opaque field meant to hold human readable text.
    status String
    The initial health-check status.
    tcp String
    The TCP address and port to connect to for a TCP check.
    tlsSkipVerify Boolean
    Whether to deactivate certificate verification for HTTP health-checks. Defaults to false.
    checkId string
    An ID, unique per agent.
    interval string
    The interval to wait between each health-check invocation.
    name string
    The name of the health-check.
    timeout string
    Specifies a timeout for outgoing connections in the case of a HTTP or TCP check.
    deregisterCriticalServiceAfter string
    The time after which the service is automatically deregistered when in the critical state. Defaults to 30s.
    headers ServiceCheckHeader[]
    The headers to send for an HTTP check. The attributes of each header is given below.
    http string
    The HTTP endpoint to call for an HTTP check.
    method string
    The method to use for HTTP health-checks. Defaults to GET.
    notes string
    An opaque field meant to hold human readable text.
    status string
    The initial health-check status.
    tcp string
    The TCP address and port to connect to for a TCP check.
    tlsSkipVerify boolean
    Whether to deactivate certificate verification for HTTP health-checks. Defaults to false.
    check_id str
    An ID, unique per agent.
    interval str
    The interval to wait between each health-check invocation.
    name str
    The name of the health-check.
    timeout str
    Specifies a timeout for outgoing connections in the case of a HTTP or TCP check.
    deregister_critical_service_after str
    The time after which the service is automatically deregistered when in the critical state. Defaults to 30s.
    headers Sequence[ServiceCheckHeader]
    The headers to send for an HTTP check. The attributes of each header is given below.
    http str
    The HTTP endpoint to call for an HTTP check.
    method str
    The method to use for HTTP health-checks. Defaults to GET.
    notes str
    An opaque field meant to hold human readable text.
    status str
    The initial health-check status.
    tcp str
    The TCP address and port to connect to for a TCP check.
    tls_skip_verify bool
    Whether to deactivate certificate verification for HTTP health-checks. Defaults to false.
    checkId String
    An ID, unique per agent.
    interval String
    The interval to wait between each health-check invocation.
    name String
    The name of the health-check.
    timeout String
    Specifies a timeout for outgoing connections in the case of a HTTP or TCP check.
    deregisterCriticalServiceAfter String
    The time after which the service is automatically deregistered when in the critical state. Defaults to 30s.
    headers List<Property Map>
    The headers to send for an HTTP check. The attributes of each header is given below.
    http String
    The HTTP endpoint to call for an HTTP check.
    method String
    The method to use for HTTP health-checks. Defaults to GET.
    notes String
    An opaque field meant to hold human readable text.
    status String
    The initial health-check status.
    tcp String
    The TCP address and port to connect to for a TCP check.
    tlsSkipVerify Boolean
    Whether to deactivate certificate verification for HTTP health-checks. Defaults to false.

    ServiceCheckHeader, ServiceCheckHeaderArgs

    Name string
    The name of the header.
    Values List<string>
    The header's list of values.
    Name string
    The name of the header.
    Values []string
    The header's list of values.
    name String
    The name of the header.
    values List<String>
    The header's list of values.
    name string
    The name of the header.
    values string[]
    The header's list of values.
    name str
    The name of the header.
    values Sequence[str]
    The header's list of values.
    name String
    The name of the header.
    values List<String>
    The header's list of values.

    Package Details

    Repository
    HashiCorp Consul pulumi/pulumi-consul
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the consul Terraform Provider.
    consul logo
    Consul v3.11.3 published on Friday, May 24, 2024 by Pulumi