1. Packages
  2. Packages
  3. Elasticstack Provider
  4. API Docs
  5. getFleetEnrollmentTokens
Viewing docs for elasticstack 0.15.0
published on Thursday, May 14, 2026 by elastic
Viewing docs for elasticstack 0.15.0
published on Thursday, May 14, 2026 by elastic

    Retrieves Elasticsearch API keys used to enroll Elastic Agents in Fleet. See the Fleet enrollment tokens documentation for more details.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as elasticstack from "@pulumi/elasticstack";
    
    const test = elasticstack.getFleetEnrollmentTokens({
        policyId: "223b1bf8-240f-463f-8466-5062670d0754",
    });
    
    import pulumi
    import pulumi_elasticstack as elasticstack
    
    test = elasticstack.get_fleet_enrollment_tokens(policy_id="223b1bf8-240f-463f-8466-5062670d0754")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/elasticstack/elasticstack"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := elasticstack.GetFleetEnrollmentTokens(ctx, &elasticstack.GetFleetEnrollmentTokensArgs{
    			PolicyId: pulumi.StringRef("223b1bf8-240f-463f-8466-5062670d0754"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Elasticstack = Pulumi.Elasticstack;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Elasticstack.GetFleetEnrollmentTokens.Invoke(new()
        {
            PolicyId = "223b1bf8-240f-463f-8466-5062670d0754",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.elasticstack.ElasticstackFunctions;
    import com.pulumi.elasticstack.inputs.GetFleetEnrollmentTokensArgs;
    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 test = ElasticstackFunctions.getFleetEnrollmentTokens(GetFleetEnrollmentTokensArgs.builder()
                .policyId("223b1bf8-240f-463f-8466-5062670d0754")
                .build());
    
        }
    }
    
    variables:
      test:
        fn::invoke:
          function: elasticstack:getFleetEnrollmentTokens
          arguments:
            policyId: 223b1bf8-240f-463f-8466-5062670d0754
    
    Example coming soon!
    

    Using getFleetEnrollmentTokens

    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 getFleetEnrollmentTokens(args: GetFleetEnrollmentTokensArgs, opts?: InvokeOptions): Promise<GetFleetEnrollmentTokensResult>
    function getFleetEnrollmentTokensOutput(args: GetFleetEnrollmentTokensOutputArgs, opts?: InvokeOptions): Output<GetFleetEnrollmentTokensResult>
    def get_fleet_enrollment_tokens(kibana_connections: Optional[Sequence[GetFleetEnrollmentTokensKibanaConnection]] = None,
                                    policy_id: Optional[str] = None,
                                    space_id: Optional[str] = None,
                                    opts: Optional[InvokeOptions] = None) -> GetFleetEnrollmentTokensResult
    def get_fleet_enrollment_tokens_output(kibana_connections: pulumi.Input[Optional[Sequence[pulumi.Input[GetFleetEnrollmentTokensKibanaConnectionArgs]]]] = None,
                                    policy_id: pulumi.Input[Optional[str]] = None,
                                    space_id: pulumi.Input[Optional[str]] = None,
                                    opts: Optional[InvokeOptions] = None) -> Output[GetFleetEnrollmentTokensResult]
    func GetFleetEnrollmentTokens(ctx *Context, args *GetFleetEnrollmentTokensArgs, opts ...InvokeOption) (*GetFleetEnrollmentTokensResult, error)
    func GetFleetEnrollmentTokensOutput(ctx *Context, args *GetFleetEnrollmentTokensOutputArgs, opts ...InvokeOption) GetFleetEnrollmentTokensResultOutput

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

    public static class GetFleetEnrollmentTokens 
    {
        public static Task<GetFleetEnrollmentTokensResult> InvokeAsync(GetFleetEnrollmentTokensArgs args, InvokeOptions? opts = null)
        public static Output<GetFleetEnrollmentTokensResult> Invoke(GetFleetEnrollmentTokensInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetFleetEnrollmentTokensResult> getFleetEnrollmentTokens(GetFleetEnrollmentTokensArgs args, InvokeOptions options)
    public static Output<GetFleetEnrollmentTokensResult> getFleetEnrollmentTokens(GetFleetEnrollmentTokensArgs args, InvokeOptions options)
    
    fn::invoke:
      function: elasticstack:index/getFleetEnrollmentTokens:getFleetEnrollmentTokens
      arguments:
        # arguments dictionary
    data "elasticstack_getfleetenrollmenttokens" "name" {
        # arguments
    }

    The following arguments are supported:

    KibanaConnections List<GetFleetEnrollmentTokensKibanaConnection>
    Kibana connection configuration block.
    PolicyId string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    SpaceId string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    KibanaConnections []GetFleetEnrollmentTokensKibanaConnection
    Kibana connection configuration block.
    PolicyId string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    SpaceId string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    kibana_connections list(object)
    Kibana connection configuration block.
    policy_id string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    space_id string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    kibanaConnections List<GetFleetEnrollmentTokensKibanaConnection>
    Kibana connection configuration block.
    policyId String
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    spaceId String
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    kibanaConnections GetFleetEnrollmentTokensKibanaConnection[]
    Kibana connection configuration block.
    policyId string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    spaceId string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    kibana_connections Sequence[GetFleetEnrollmentTokensKibanaConnection]
    Kibana connection configuration block.
    policy_id str
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    space_id str
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    kibanaConnections List<Property Map>
    Kibana connection configuration block.
    policyId String
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    spaceId String
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.

    getFleetEnrollmentTokens Result

    The following output properties are available:

    Id string
    The ID of this resource.
    Tokens List<GetFleetEnrollmentTokensToken>
    A list of enrollment tokens.
    KibanaConnections List<GetFleetEnrollmentTokensKibanaConnection>
    Kibana connection configuration block.
    PolicyId string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    SpaceId string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    Id string
    The ID of this resource.
    Tokens []GetFleetEnrollmentTokensToken
    A list of enrollment tokens.
    KibanaConnections []GetFleetEnrollmentTokensKibanaConnection
    Kibana connection configuration block.
    PolicyId string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    SpaceId string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    id string
    The ID of this resource.
    tokens list(object)
    A list of enrollment tokens.
    kibana_connections list(object)
    Kibana connection configuration block.
    policy_id string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    space_id string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    id String
    The ID of this resource.
    tokens List<GetFleetEnrollmentTokensToken>
    A list of enrollment tokens.
    kibanaConnections List<GetFleetEnrollmentTokensKibanaConnection>
    Kibana connection configuration block.
    policyId String
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    spaceId String
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    id string
    The ID of this resource.
    tokens GetFleetEnrollmentTokensToken[]
    A list of enrollment tokens.
    kibanaConnections GetFleetEnrollmentTokensKibanaConnection[]
    Kibana connection configuration block.
    policyId string
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    spaceId string
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    id str
    The ID of this resource.
    tokens Sequence[GetFleetEnrollmentTokensToken]
    A list of enrollment tokens.
    kibana_connections Sequence[GetFleetEnrollmentTokensKibanaConnection]
    Kibana connection configuration block.
    policy_id str
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    space_id str
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.
    id String
    The ID of this resource.
    tokens List<Property Map>
    A list of enrollment tokens.
    kibanaConnections List<Property Map>
    Kibana connection configuration block.
    policyId String
    The identifier of the target agent policy. When provided, only the enrollment tokens associated with this agent policy will be selected. Omit this value to select all enrollment tokens.
    spaceId String
    The Kibana space ID to query enrollment tokens from. When the agent policy is space-scoped, this must be set to match the policy's space. If not specified, queries the default space.

    Supporting Types

    GetFleetEnrollmentTokensKibanaConnection

    ApiKey string
    API Key to use for authentication to Kibana
    BearerToken string
    Bearer Token to use for authentication to Kibana
    CaCerts List<string>
    A list of paths to CA certificates to validate the certificate presented by the Kibana server.
    Endpoints List<string>
    Insecure bool
    Disable TLS certificate validation
    Password string
    Password to use for API authentication to Kibana.
    Username string
    Username to use for API authentication to Kibana.
    ApiKey string
    API Key to use for authentication to Kibana
    BearerToken string
    Bearer Token to use for authentication to Kibana
    CaCerts []string
    A list of paths to CA certificates to validate the certificate presented by the Kibana server.
    Endpoints []string
    Insecure bool
    Disable TLS certificate validation
    Password string
    Password to use for API authentication to Kibana.
    Username string
    Username to use for API authentication to Kibana.
    api_key string
    API Key to use for authentication to Kibana
    bearer_token string
    Bearer Token to use for authentication to Kibana
    ca_certs list(string)
    A list of paths to CA certificates to validate the certificate presented by the Kibana server.
    endpoints list(string)
    insecure bool
    Disable TLS certificate validation
    password string
    Password to use for API authentication to Kibana.
    username string
    Username to use for API authentication to Kibana.
    apiKey String
    API Key to use for authentication to Kibana
    bearerToken String
    Bearer Token to use for authentication to Kibana
    caCerts List<String>
    A list of paths to CA certificates to validate the certificate presented by the Kibana server.
    endpoints List<String>
    insecure Boolean
    Disable TLS certificate validation
    password String
    Password to use for API authentication to Kibana.
    username String
    Username to use for API authentication to Kibana.
    apiKey string
    API Key to use for authentication to Kibana
    bearerToken string
    Bearer Token to use for authentication to Kibana
    caCerts string[]
    A list of paths to CA certificates to validate the certificate presented by the Kibana server.
    endpoints string[]
    insecure boolean
    Disable TLS certificate validation
    password string
    Password to use for API authentication to Kibana.
    username string
    Username to use for API authentication to Kibana.
    api_key str
    API Key to use for authentication to Kibana
    bearer_token str
    Bearer Token to use for authentication to Kibana
    ca_certs Sequence[str]
    A list of paths to CA certificates to validate the certificate presented by the Kibana server.
    endpoints Sequence[str]
    insecure bool
    Disable TLS certificate validation
    password str
    Password to use for API authentication to Kibana.
    username str
    Username to use for API authentication to Kibana.
    apiKey String
    API Key to use for authentication to Kibana
    bearerToken String
    Bearer Token to use for authentication to Kibana
    caCerts List<String>
    A list of paths to CA certificates to validate the certificate presented by the Kibana server.
    endpoints List<String>
    insecure Boolean
    Disable TLS certificate validation
    password String
    Password to use for API authentication to Kibana.
    username String
    Username to use for API authentication to Kibana.

    GetFleetEnrollmentTokensToken

    Active bool
    Indicates if the enrollment token is active.
    ApiKey string
    The API key.
    ApiKeyId string
    The API key identifier.
    CreatedAt string
    The time at which the enrollment token was created.
    KeyId string
    The unique identifier of the enrollment token.
    Name string
    The name of the enrollment token.
    PolicyId string
    The identifier of the associated agent policy.
    Active bool
    Indicates if the enrollment token is active.
    ApiKey string
    The API key.
    ApiKeyId string
    The API key identifier.
    CreatedAt string
    The time at which the enrollment token was created.
    KeyId string
    The unique identifier of the enrollment token.
    Name string
    The name of the enrollment token.
    PolicyId string
    The identifier of the associated agent policy.
    active bool
    Indicates if the enrollment token is active.
    api_key string
    The API key.
    api_key_id string
    The API key identifier.
    created_at string
    The time at which the enrollment token was created.
    key_id string
    The unique identifier of the enrollment token.
    name string
    The name of the enrollment token.
    policy_id string
    The identifier of the associated agent policy.
    active Boolean
    Indicates if the enrollment token is active.
    apiKey String
    The API key.
    apiKeyId String
    The API key identifier.
    createdAt String
    The time at which the enrollment token was created.
    keyId String
    The unique identifier of the enrollment token.
    name String
    The name of the enrollment token.
    policyId String
    The identifier of the associated agent policy.
    active boolean
    Indicates if the enrollment token is active.
    apiKey string
    The API key.
    apiKeyId string
    The API key identifier.
    createdAt string
    The time at which the enrollment token was created.
    keyId string
    The unique identifier of the enrollment token.
    name string
    The name of the enrollment token.
    policyId string
    The identifier of the associated agent policy.
    active bool
    Indicates if the enrollment token is active.
    api_key str
    The API key.
    api_key_id str
    The API key identifier.
    created_at str
    The time at which the enrollment token was created.
    key_id str
    The unique identifier of the enrollment token.
    name str
    The name of the enrollment token.
    policy_id str
    The identifier of the associated agent policy.
    active Boolean
    Indicates if the enrollment token is active.
    apiKey String
    The API key.
    apiKeyId String
    The API key identifier.
    createdAt String
    The time at which the enrollment token was created.
    keyId String
    The unique identifier of the enrollment token.
    name String
    The name of the enrollment token.
    policyId String
    The identifier of the associated agent policy.

    Package Details

    Repository
    elasticstack elastic/terraform-provider-elasticstack
    License
    Notes
    This Pulumi package is based on the elasticstack Terraform Provider.
    Viewing docs for elasticstack 0.15.0
    published on Thursday, May 14, 2026 by elastic
      Try Pulumi Cloud free. Your team will thank you.