1. Packages
  2. Consul Provider
  3. API Docs
  4. AgentService
Consul v3.12.2 published on Wednesday, Oct 16, 2024 by Pulumi

consul.AgentService

Explore with Pulumi AI

consul logo
Consul v3.12.2 published on Wednesday, Oct 16, 2024 by Pulumi

    !> The consul.AgentService resource has been deprecated in version 2.0.0 of the provider and will be removed in a future release. Please read the upgrade guide for more information.

    Provides access to the agent service data in Consul. This can be used to define a service associated with a particular agent. Currently, defining health checks for an agent service is not supported.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    const app = new consul.AgentService("app", {
        address: "www.google.com",
        name: "google",
        port: 80,
        tags: [
            "tag0",
            "tag1",
        ],
    });
    
    import pulumi
    import pulumi_consul as consul
    
    app = consul.AgentService("app",
        address="www.google.com",
        name="google",
        port=80,
        tags=[
            "tag0",
            "tag1",
        ])
    
    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.NewAgentService(ctx, "app", &consul.AgentServiceArgs{
    			Address: pulumi.String("www.google.com"),
    			Name:    pulumi.String("google"),
    			Port:    pulumi.Int(80),
    			Tags: pulumi.StringArray{
    				pulumi.String("tag0"),
    				pulumi.String("tag1"),
    			},
    		})
    		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 app = new Consul.AgentService("app", new()
        {
            Address = "www.google.com",
            Name = "google",
            Port = 80,
            Tags = new[]
            {
                "tag0",
                "tag1",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.consul.AgentService;
    import com.pulumi.consul.AgentServiceArgs;
    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 app = new AgentService("app", AgentServiceArgs.builder()
                .address("www.google.com")
                .name("google")
                .port(80)
                .tags(            
                    "tag0",
                    "tag1")
                .build());
    
        }
    }
    
    resources:
      app:
        type: consul:AgentService
        properties:
          address: www.google.com
          name: google
          port: 80
          tags:
            - tag0
            - tag1
    

    Create AgentService Resource

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

    Constructor syntax

    new AgentService(name: string, args?: AgentServiceArgs, opts?: CustomResourceOptions);
    @overload
    def AgentService(resource_name: str,
                     args: Optional[AgentServiceArgs] = None,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def AgentService(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     address: Optional[str] = None,
                     name: Optional[str] = None,
                     port: Optional[int] = None,
                     tags: Optional[Sequence[str]] = None)
    func NewAgentService(ctx *Context, name string, args *AgentServiceArgs, opts ...ResourceOption) (*AgentService, error)
    public AgentService(string name, AgentServiceArgs? args = null, CustomResourceOptions? opts = null)
    public AgentService(String name, AgentServiceArgs args)
    public AgentService(String name, AgentServiceArgs args, CustomResourceOptions options)
    
    type: consul:AgentService
    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 AgentServiceArgs
    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 AgentServiceArgs
    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 AgentServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AgentServiceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AgentServiceArgs
    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 agentServiceResource = new Consul.AgentService("agentServiceResource", new()
    {
        Address = "string",
        Name = "string",
        Port = 0,
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := consul.NewAgentService(ctx, "agentServiceResource", &consul.AgentServiceArgs{
    	Address: pulumi.String("string"),
    	Name:    pulumi.String("string"),
    	Port:    pulumi.Int(0),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var agentServiceResource = new AgentService("agentServiceResource", AgentServiceArgs.builder()
        .address("string")
        .name("string")
        .port(0)
        .tags("string")
        .build());
    
    agent_service_resource = consul.AgentService("agentServiceResource",
        address="string",
        name="string",
        port=0,
        tags=["string"])
    
    const agentServiceResource = new consul.AgentService("agentServiceResource", {
        address: "string",
        name: "string",
        port: 0,
        tags: ["string"],
    });
    
    type: consul:AgentService
    properties:
        address: string
        name: string
        port: 0
        tags:
            - string
    

    AgentService Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The AgentService resource accepts the following input properties:

    Address string
    The address of the service. Defaults to the address of the agent.
    Name string
    The name of the service.
    Port int
    The port of the service.
    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 agent.
    Name string
    The name of the service.
    Port int
    The port of the service.
    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 agent.
    name String
    The name of the service.
    port Integer
    The port of the service.
    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 agent.
    name string
    The name of the service.
    port number
    The port of the service.
    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 agent.
    name str
    The name of the service.
    port int
    The port of the service.
    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 agent.
    name String
    The name of the service.
    port Number
    The port of the service.
    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 AgentService 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 AgentService Resource

    Get an existing AgentService 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?: AgentServiceState, opts?: CustomResourceOptions): AgentService
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            address: Optional[str] = None,
            name: Optional[str] = None,
            port: Optional[int] = None,
            tags: Optional[Sequence[str]] = None) -> AgentService
    func GetAgentService(ctx *Context, name string, id IDInput, state *AgentServiceState, opts ...ResourceOption) (*AgentService, error)
    public static AgentService Get(string name, Input<string> id, AgentServiceState? state, CustomResourceOptions? opts = null)
    public static AgentService get(String name, Output<String> id, AgentServiceState 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 agent.
    Name string
    The name of the service.
    Port int
    The port of the service.
    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 agent.
    Name string
    The name of the service.
    Port int
    The port of the service.
    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 agent.
    name String
    The name of the service.
    port Integer
    The port of the service.
    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 agent.
    name string
    The name of the service.
    port number
    The port of the service.
    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 agent.
    name str
    The name of the service.
    port int
    The port of the service.
    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 agent.
    name String
    The name of the service.
    port Number
    The port of the service.
    tags List<String>
    A list of values that are opaque to Consul, but can be used to distinguish between services or nodes.

    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.12.2 published on Wednesday, Oct 16, 2024 by Pulumi