1. Packages
  2. Packages
  3. Aiven Provider
  4. API Docs
  5. getKafkaTopic
Viewing docs for Aiven v5.6.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
aiven logo
Viewing docs for Aiven v5.6.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    The Kafka Topic data source provides information about the existing Aiven Kafka Topic.

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using Aiven = Pulumi.Aiven;
    
    return await Deployment.RunAsync(() => 
    {
        var mytesttopic = Aiven.GetKafkaTopic.Invoke(new()
        {
            Project = aiven_project.Myproject.Project,
            ServiceName = aiven_kafka.Myservice.Service_name,
            TopicName = "<TOPIC_NAME>",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aiven/sdk/v5/go/aiven"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aiven.LookupKafkaTopic(ctx, &aiven.LookupKafkaTopicArgs{
    			Project:     aiven_project.Myproject.Project,
    			ServiceName: aiven_kafka.Myservice.Service_name,
    			TopicName:   "<TOPIC_NAME>",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aiven.AivenFunctions;
    import com.pulumi.aiven.inputs.GetKafkaTopicArgs;
    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 mytesttopic = AivenFunctions.getKafkaTopic(GetKafkaTopicArgs.builder()
                .project(aiven_project.myproject().project())
                .serviceName(aiven_kafka.myservice().service_name())
                .topicName("<TOPIC_NAME>")
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    const mytesttopic = aiven.getKafkaTopic({
        project: aiven_project.myproject.project,
        serviceName: aiven_kafka.myservice.service_name,
        topicName: "<TOPIC_NAME>",
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    mytesttopic = aiven.get_kafka_topic(project=aiven_project["myproject"]["project"],
        service_name=aiven_kafka["myservice"]["service_name"],
        topic_name="<TOPIC_NAME>")
    
    variables:
      mytesttopic:
        fn::invoke:
          Function: aiven:getKafkaTopic
          Arguments:
            project: ${aiven_project.myproject.project}
            serviceName: ${aiven_kafka.myservice.service_name}
            topicName: <TOPIC_NAME>
    

    Using getKafkaTopic

    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 getKafkaTopic(args: GetKafkaTopicArgs, opts?: InvokeOptions): Promise<GetKafkaTopicResult>
    function getKafkaTopicOutput(args: GetKafkaTopicOutputArgs, opts?: InvokeOptions): Output<GetKafkaTopicResult>
    def get_kafka_topic(project: Optional[str] = None,
                        service_name: Optional[str] = None,
                        topic_name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetKafkaTopicResult
    def get_kafka_topic_output(project: Optional[pulumi.Input[str]] = None,
                        service_name: Optional[pulumi.Input[str]] = None,
                        topic_name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetKafkaTopicResult]
    func LookupKafkaTopic(ctx *Context, args *LookupKafkaTopicArgs, opts ...InvokeOption) (*LookupKafkaTopicResult, error)
    func LookupKafkaTopicOutput(ctx *Context, args *LookupKafkaTopicOutputArgs, opts ...InvokeOption) LookupKafkaTopicResultOutput

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

    public static class GetKafkaTopic 
    {
        public static Task<GetKafkaTopicResult> InvokeAsync(GetKafkaTopicArgs args, InvokeOptions? opts = null)
        public static Output<GetKafkaTopicResult> Invoke(GetKafkaTopicInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKafkaTopicResult> getKafkaTopic(GetKafkaTopicArgs args, InvokeOptions options)
    public static Output<GetKafkaTopicResult> getKafkaTopic(GetKafkaTopicArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aiven:index/getKafkaTopic:getKafkaTopic
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    TopicName string
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    TopicName string
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    topicName String
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    topicName string
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    topic_name str
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    topicName String
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.

    getKafkaTopic Result

    The following output properties are available:

    Configs List<GetKafkaTopicConfig>
    Kafka topic configuration
    Id string
    The provider-assigned unique ID for this managed resource.
    Partitions int
    The number of partitions to create in the topic.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    Replication int
    The replication factor for the topic.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    Tags List<GetKafkaTopicTag>
    Kafka Topic tag.
    TerminationProtection bool
    TopicName string
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    Configs []GetKafkaTopicConfig
    Kafka topic configuration
    Id string
    The provider-assigned unique ID for this managed resource.
    Partitions int
    The number of partitions to create in the topic.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    Replication int
    The replication factor for the topic.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    Tags []GetKafkaTopicTag
    Kafka Topic tag.
    TerminationProtection bool
    TopicName string
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    configs List<GetKafkaTopicConfig>
    Kafka topic configuration
    id String
    The provider-assigned unique ID for this managed resource.
    partitions Integer
    The number of partitions to create in the topic.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    replication Integer
    The replication factor for the topic.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    tags List<GetKafkaTopicTag>
    Kafka Topic tag.
    terminationProtection Boolean
    topicName String
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    configs GetKafkaTopicConfig[]
    Kafka topic configuration
    id string
    The provider-assigned unique ID for this managed resource.
    partitions number
    The number of partitions to create in the topic.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    replication number
    The replication factor for the topic.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    tags GetKafkaTopicTag[]
    Kafka Topic tag.
    terminationProtection boolean
    topicName string
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    configs Sequence[GetKafkaTopicConfig]
    Kafka topic configuration
    id str
    The provider-assigned unique ID for this managed resource.
    partitions int
    The number of partitions to create in the topic.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    replication int
    The replication factor for the topic.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    tags Sequence[GetKafkaTopicTag]
    Kafka Topic tag.
    termination_protection bool
    topic_name str
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.
    configs List<Property Map>
    Kafka topic configuration
    id String
    The provider-assigned unique ID for this managed resource.
    partitions Number
    The number of partitions to create in the topic.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    replication Number
    The replication factor for the topic.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    tags List<Property Map>
    Kafka Topic tag.
    terminationProtection Boolean
    topicName String
    The name of the topic. This property cannot be changed, doing so forces recreation of the resource.

    Supporting Types

    GetKafkaTopicConfig

    GetKafkaTopicTag

    Key string
    Value string
    Key string
    Value string
    key String
    value String
    key string
    value string
    key str
    value str
    key String
    value String

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Viewing docs for Aiven v5.6.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.