Class 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",
},
});
}
}
Inherited Members
Namespace: Pulumi.Consul
Assembly: Pulumi.Consul.dll
Syntax
public class Service : CustomResource
Constructors
View SourceService(String, ServiceArgs, CustomResourceOptions)
Create a Service resource with the given unique name, arguments, and options.
Declaration
public Service(string name, ServiceArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| ServiceArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceAddress
The address of the service. Defaults to the address of the node.
Declaration
public Output<string> Address { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Checks
Declaration
public Output<ImmutableArray<ServiceCheck>> Checks { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<ServiceCheck>> |
Datacenter
The datacenter to use. This overrides the agent's default datacenter and the datacenter in the provider setup.
Declaration
public Output<string> Datacenter { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
External
Declaration
public Output<bool?> External { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Meta
A map of arbitrary KV metadata linked to the service instance.
Declaration
public Output<ImmutableDictionary<string, string>> Meta { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.String>> |
Name
The name of the health-check.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Namespace
The namespace to create the service within.
Declaration
public Output<string> Namespace { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Node
The name of the node the to register the service on.
Declaration
public Output<string> Node { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Port
The port of the service.
Declaration
public Output<int?> Port { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
ServiceId
- If the service ID is not provided, it will be defaulted to the value
of the
nameattribute.
Declaration
public Output<string> ServiceId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.
Declaration
public Output<ImmutableArray<string>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<System.String>> |
Methods
View SourceGet(String, Input<String>, ServiceState, CustomResourceOptions)
Get an existing Service resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Service Get(string name, Input<string> id, ServiceState 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. |
| ServiceState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Service |