Service
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.
If the Consul agent is running on the node where this service is registered, it is not recommended to use this resource.
Example Usage
using Pulumi;
using Consul = Pulumi.Consul;
class MyStack : Stack
{
public MyStack()
{
var compute = new Consul.Node("compute", new Consul.NodeArgs
{
Address = "www.google.com",
});
var google = new Consul.Service("google", new Consul.ServiceArgs
{
Node = compute.Name,
Port = 80,
Tags =
{
"tag0",
},
});
}
}
Coming soon!
import pulumi
import pulumi_consul as consul
compute = consul.Node("compute", address="www.google.com")
google = consul.Service("google",
node=compute.name,
port=80,
tags=["tag0"])import * as pulumi from "@pulumi/pulumi";
import * as consul from "@pulumi/consul";
const compute = new consul.Node("compute", {
address: "www.google.com",
});
const google = new consul.Service("google", {
node: compute.name,
port: 80,
tags: ["tag0"],
});Create a Service Resource
new Service(name: string, args: ServiceArgs, opts?: CustomResourceOptions);def Service(resource_name, opts=None, address=None, checks=None, datacenter=None, external=None, meta=None, name=None, namespace=None, node=None, port=None, service_id=None, tags=None, __props__=None);func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)public Service(string name, ServiceArgs args, CustomResourceOptions? opts = null)- 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.
- 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 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.
Service Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model 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<Service
Check Args> - Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- External bool
- Meta Dictionary<string, string>
A map of arbitrary KV metadata linked to the service instance.
- Name string
The name of the health-check.
- Namespace string
The namespace to create the service within.
- Port int
The port of the service.
- Service
Id string - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- 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
[]Service
Check - Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- External bool
- Meta map[string]string
A map of arbitrary KV metadata linked to the service instance.
- Name string
The name of the health-check.
- Namespace string
The namespace to create the service within.
- Port int
The port of the service.
- Service
Id string - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- []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
Service
Check[] - datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- external boolean
- meta {[key: string]: string}
A map of arbitrary KV metadata linked to the service instance.
- name string
The name of the health-check.
- namespace string
The namespace to create the service within.
- port number
The port of the service.
- service
Id string - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- 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
List[Service
Check] - datacenter str
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- external bool
- meta Dict[str, str]
A map of arbitrary KV metadata linked to the service instance.
- name str
The name of the health-check.
- namespace str
The namespace to create the service within.
- port float
The port of the service.
- service_
id str - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- List[str]
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:
Look up an 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): Servicestatic get(resource_name, id, opts=None, address=None, checks=None, datacenter=None, external=None, meta=None, name=None, namespace=None, node=None, port=None, service_id=None, tags=None, __props__=None);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)- 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:
- Address string
The address of the service. Defaults to the address of the node.
- Checks
List<Service
Check Args> - Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- External bool
- Meta Dictionary<string, string>
A map of arbitrary KV metadata linked to the service instance.
- Name string
The name of the health-check.
- Namespace string
The namespace to create the service within.
- Node string
The name of the node the to register the service on.
- Port int
The port of the service.
- Service
Id string - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- 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
[]Service
Check - Datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- External bool
- Meta map[string]string
A map of arbitrary KV metadata linked to the service instance.
- Name string
The name of the health-check.
- Namespace string
The namespace to create the service within.
- Node string
The name of the node the to register the service on.
- Port int
The port of the service.
- Service
Id string - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- []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
Service
Check[] - datacenter string
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- external boolean
- meta {[key: string]: string}
A map of arbitrary KV metadata linked to the service instance.
- name string
The name of the health-check.
- namespace string
The namespace to create the service within.
- node string
The name of the node the to register the service on.
- port number
The port of the service.
- service
Id string - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- 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
List[Service
Check] - datacenter str
The datacenter to use. This overrides the agent’s default datacenter and the datacenter in the provider setup.
- external bool
- meta Dict[str, str]
A map of arbitrary KV metadata linked to the service instance.
- name str
The name of the health-check.
- namespace str
The namespace to create the service within.
- node str
The name of the node the to register the service on.
- port float
The port of the service.
- service_
id str - If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
- If the service ID is not provided, it will be defaulted to the value
of the
- List[str]
A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
Supporting Types
ServiceCheck
- Check
Id string An ID, unique per agent. Will default to name if not set.
- Interval string
The interval to wait between each health-check invocation.
- Name string
The name of the health-check.
- Timeout string
The timeout value for HTTP checks.
- Deregister
Critical stringService After The time after which the service is automatically deregistered when in the
criticalstate. Defaults to30s.- Headers
List<Service
Check Header Args> 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.
- Tls
Skip boolVerify Whether to deactivate certificate verification for HTTP health-checks. Defaults to
false.
- Check
Id string An ID, unique per agent. Will default to name if not set.
- Interval string
The interval to wait between each health-check invocation.
- Name string
The name of the health-check.
- Timeout string
The timeout value for HTTP checks.
- Deregister
Critical stringService After The time after which the service is automatically deregistered when in the
criticalstate. Defaults to30s.- Headers
[]Service
Check Header 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.
- Tls
Skip boolVerify Whether to deactivate certificate verification for HTTP health-checks. Defaults to
false.
- check
Id string An ID, unique per agent. Will default to name if not set.
- interval string
The interval to wait between each health-check invocation.
- name string
The name of the health-check.
- timeout string
The timeout value for HTTP checks.
- deregister
Critical stringService After The time after which the service is automatically deregistered when in the
criticalstate. Defaults to30s.- headers
Service
Check Header[] 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.
- tls
Skip booleanVerify Whether to deactivate certificate verification for HTTP health-checks. Defaults to
false.
- check
Id str An ID, unique per agent. Will default to name if not set.
- interval str
The interval to wait between each health-check invocation.
- name str
The name of the health-check.
- timeout str
The timeout value for HTTP checks.
- deregister
Critical strService After The time after which the service is automatically deregistered when in the
criticalstate. Defaults to30s.- headers
List[Service
Check Header] 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 boolVerify Whether to deactivate certificate verification for HTTP health-checks. Defaults to
false.
ServiceCheckHeader
- Name string
The name of the header.
- Values List<string>
The header’s list of values.
Package Details
- Repository
- https://github.com/pulumi/pulumi-consul
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
consulTerraform Provider.