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

consul.getAgentConfig

Explore with Pulumi AI

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

    Note: The consul.getAgentConfig resource differs from consul.getAgentSelf, providing less information but utilizing stable APIs. consul.getAgentSelf will be deprecated in a future release.

    The consul.getAgentConfig data source returns configuration data from the agent specified in the provider.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as consul from "@pulumi/consul";
    
    const remoteAgent = consul.getAgentConfig({});
    export const consulVersion = remoteAgent.then(remoteAgent => remoteAgent.version);
    
    import pulumi
    import pulumi_consul as consul
    
    remote_agent = consul.get_agent_config()
    pulumi.export("consulVersion", remote_agent.version)
    
    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 {
    		remoteAgent, err := consul.GetAgentConfig(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("consulVersion", remoteAgent.Version)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Consul = Pulumi.Consul;
    
    return await Deployment.RunAsync(() => 
    {
        var remoteAgent = Consul.GetAgentConfig.Invoke();
    
        return new Dictionary<string, object?>
        {
            ["consulVersion"] = remoteAgent.Apply(getAgentConfigResult => getAgentConfigResult.Version),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.consul.ConsulFunctions;
    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) {
            final var remoteAgent = ConsulFunctions.getAgentConfig();
    
            ctx.export("consulVersion", remoteAgent.applyValue(getAgentConfigResult -> getAgentConfigResult.version()));
        }
    }
    
    variables:
      remoteAgent:
        fn::invoke:
          Function: consul:getAgentConfig
          Arguments: {}
    outputs:
      consulVersion: ${remoteAgent.version}
    

    Using getAgentConfig

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getAgentConfig(opts?: InvokeOptions): Promise<GetAgentConfigResult>
    function getAgentConfigOutput(opts?: InvokeOptions): Output<GetAgentConfigResult>
    def get_agent_config(opts: Optional[InvokeOptions] = None) -> GetAgentConfigResult
    def get_agent_config_output(opts: Optional[InvokeOptions] = None) -> Output[GetAgentConfigResult]
    func GetAgentConfig(ctx *Context, opts ...InvokeOption) (*GetAgentConfigResult, error)
    func GetAgentConfigOutput(ctx *Context, opts ...InvokeOption) GetAgentConfigResultOutput

    > Note: This function is named GetAgentConfig in the Go SDK.

    public static class GetAgentConfig 
    {
        public static Task<GetAgentConfigResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetAgentConfigResult> Invoke(InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAgentConfigResult> getAgentConfig(InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: consul:index/getAgentConfig:getAgentConfig
      arguments:
        # arguments dictionary

    getAgentConfig Result

    The following output properties are available:

    Datacenter string
    The datacenter the agent is running in
    Id string
    The provider-assigned unique ID for this managed resource.
    NodeId string
    The ID of the node the agent is running on
    NodeName string
    The name of the node the agent is running on
    Revision string
    The first 9 characters of the VCS revision of the build of Consul that is running
    Server bool
    Boolean if the agent is a server or not
    Version string
    The version of the build of Consul that is running
    Datacenter string
    The datacenter the agent is running in
    Id string
    The provider-assigned unique ID for this managed resource.
    NodeId string
    The ID of the node the agent is running on
    NodeName string
    The name of the node the agent is running on
    Revision string
    The first 9 characters of the VCS revision of the build of Consul that is running
    Server bool
    Boolean if the agent is a server or not
    Version string
    The version of the build of Consul that is running
    datacenter String
    The datacenter the agent is running in
    id String
    The provider-assigned unique ID for this managed resource.
    nodeId String
    The ID of the node the agent is running on
    nodeName String
    The name of the node the agent is running on
    revision String
    The first 9 characters of the VCS revision of the build of Consul that is running
    server Boolean
    Boolean if the agent is a server or not
    version String
    The version of the build of Consul that is running
    datacenter string
    The datacenter the agent is running in
    id string
    The provider-assigned unique ID for this managed resource.
    nodeId string
    The ID of the node the agent is running on
    nodeName string
    The name of the node the agent is running on
    revision string
    The first 9 characters of the VCS revision of the build of Consul that is running
    server boolean
    Boolean if the agent is a server or not
    version string
    The version of the build of Consul that is running
    datacenter str
    The datacenter the agent is running in
    id str
    The provider-assigned unique ID for this managed resource.
    node_id str
    The ID of the node the agent is running on
    node_name str
    The name of the node the agent is running on
    revision str
    The first 9 characters of the VCS revision of the build of Consul that is running
    server bool
    Boolean if the agent is a server or not
    version str
    The version of the build of Consul that is running
    datacenter String
    The datacenter the agent is running in
    id String
    The provider-assigned unique ID for this managed resource.
    nodeId String
    The ID of the node the agent is running on
    nodeName String
    The name of the node the agent is running on
    revision String
    The first 9 characters of the VCS revision of the build of Consul that is running
    server Boolean
    Boolean if the agent is a server or not
    version String
    The version of the build of Consul that is running

    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