1. Packages
  2. Packages
  3. Clickhouse
  4. API Docs
  5. ApiKey
  6. getId
Viewing docs for Clickhouse v2.0.1
published on Thursday, May 21, 2026 by pulumiverse
clickhouse logo
Viewing docs for Clickhouse v2.0.1
published on Thursday, May 21, 2026 by pulumiverse

    The clickhouse_api_key_id data source can be used to retrieve the UUID of a ClickHouse cloud API key. It is meant to be used in the clickhouse_service resource to set the queryApiEndpoints attribute.

    It can be used in two ways:

    1. To retrieve information about an API Key, by providing its name
    2. To retrieve information about the API Key currently configured for running the terraform provider

    In both cases the data source will contain the id and name attributes.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as clickhouse from "@pulumiverse/clickhouse";
    
    const myApiKey = clickhouse.ApiKey.getId({
        name: "my-api-key",
    });
    
    import pulumi
    import pulumi_clickhouse as clickhouse
    
    my_api_key = clickhouse.ApiKey.get_id(name="my-api-key")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-clickhouse/sdk/go/clickhouse/apikey"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := apikey.GetId(ctx, &apikey.GetIdArgs{
    			Name: pulumi.StringRef("my-api-key"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Clickhouse = Pulumiverse.Clickhouse;
    
    return await Deployment.RunAsync(() => 
    {
        var myApiKey = Clickhouse.ApiKey.GetId.Invoke(new()
        {
            Name = "my-api-key",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.clickhouse.ApiKey.ApiKeyFunctions;
    import com.pulumi.clickhouse.ApiKey.inputs.GetIdArgs;
    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 myApiKey = ApiKeyFunctions.getId(GetIdArgs.builder()
                .name("my-api-key")
                .build());
    
        }
    }
    
    variables:
      myApiKey:
        fn::invoke:
          function: clickhouse:ApiKey:getId
          arguments:
            name: my-api-key
    
    Example coming soon!
    

    Using getId

    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 getId(args: GetIdArgs, opts?: InvokeOptions): Promise<GetIdResult>
    function getIdOutput(args: GetIdOutputArgs, opts?: InvokeOptions): Output<GetIdResult>
    def get_id(name: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetIdResult
    def get_id_output(name: pulumi.Input[Optional[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetIdResult]
    func GetId(ctx *Context, args *GetIdArgs, opts ...InvokeOption) (*GetIdResult, error)
    func GetIdOutput(ctx *Context, args *GetIdOutputArgs, opts ...InvokeOption) GetIdResultOutput

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

    public static class GetId 
    {
        public static Task<GetIdResult> InvokeAsync(GetIdArgs args, InvokeOptions? opts = null)
        public static Output<GetIdResult> Invoke(GetIdInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetIdResult> getId(GetIdArgs args, InvokeOptions options)
    public static Output<GetIdResult> getId(GetIdArgs args, InvokeOptions options)
    
    fn::invoke:
      function: clickhouse:ApiKey/getId:getId
      arguments:
        # arguments dictionary
    data "clickhouse_apikey_getid" "name" {
        # arguments
    }

    The following arguments are supported:

    Name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    Name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    name String
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    name str
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    name String
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.

    getId Result

    The following output properties are available:

    Id string
    The ID of the API key used by the provider to connect to the service. This is a read-only attribute.
    Name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    Id string
    The ID of the API key used by the provider to connect to the service. This is a read-only attribute.
    Name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    id string
    The ID of the API key used by the provider to connect to the service. This is a read-only attribute.
    name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    id String
    The ID of the API key used by the provider to connect to the service. This is a read-only attribute.
    name String
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    id string
    The ID of the API key used by the provider to connect to the service. This is a read-only attribute.
    name string
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    id str
    The ID of the API key used by the provider to connect to the service. This is a read-only attribute.
    name str
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.
    id String
    The ID of the API key used by the provider to connect to the service. This is a read-only attribute.
    name String
    The name of the API key to retrieve information about. If left empty, the API key used by the Terraform provider is used instead.

    Package Details

    Repository
    clickhouse pulumiverse/pulumi-clickhouse
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the clickhouse Terraform Provider.
    clickhouse logo
    Viewing docs for Clickhouse v2.0.1
    published on Thursday, May 21, 2026 by pulumiverse

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial