1. Packages
  2. Packages
  3. Confluent Provider
  4. API Docs
  5. KafkaTopic
Viewing docs for Confluent v0.1.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
confluentcloud logo
Viewing docs for Confluent v0.1.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Import

    You can import a Kafka topic by using the Kafka cluster ID and Kafka topic name in the format <Kafka cluster ID>/<Kafka topic name>, for example$ export KAFKA_API_KEY="<kafka_api_key>" $ export KAFKA_API_SECRET="<kafka_api_secret>" $ export KAFKA_HTTP_ENDPOINT="<kafka_http_endpoint>"

     $ pulumi import confluentcloud:index/kafkaTopic:KafkaTopic my_topic lkc-abc123/orders-123
    

    !> Warning: Do not forget to delete terminal command history afterwards for security purposes.

    Create KafkaTopic Resource

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

    Constructor syntax

    new KafkaTopic(name: string, args: KafkaTopicArgs, opts?: CustomResourceOptions);
    @overload
    def KafkaTopic(resource_name: str,
                   args: KafkaTopicArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def KafkaTopic(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   credentials: Optional[KafkaTopicCredentialsArgs] = None,
                   http_endpoint: Optional[str] = None,
                   kafka_cluster: Optional[KafkaTopicKafkaClusterArgs] = None,
                   topic_name: Optional[str] = None,
                   config: Optional[Mapping[str, str]] = None,
                   partitions_count: Optional[int] = None)
    func NewKafkaTopic(ctx *Context, name string, args KafkaTopicArgs, opts ...ResourceOption) (*KafkaTopic, error)
    public KafkaTopic(string name, KafkaTopicArgs args, CustomResourceOptions? opts = null)
    public KafkaTopic(String name, KafkaTopicArgs args)
    public KafkaTopic(String name, KafkaTopicArgs args, CustomResourceOptions options)
    
    type: confluentcloud:KafkaTopic
    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 KafkaTopicArgs
    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 KafkaTopicArgs
    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 KafkaTopicArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KafkaTopicArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KafkaTopicArgs
    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 kafkaTopicResource = new ConfluentCloud.KafkaTopic("kafkaTopicResource", new()
    {
        Credentials = new ConfluentCloud.Inputs.KafkaTopicCredentialsArgs
        {
            Key = "string",
            Secret = "string",
        },
        HttpEndpoint = "string",
        KafkaCluster = new ConfluentCloud.Inputs.KafkaTopicKafkaClusterArgs
        {
            Id = "string",
        },
        TopicName = "string",
        Config = 
        {
            { "string", "string" },
        },
        PartitionsCount = 0,
    });
    
    example, err := confluentcloud.NewKafkaTopic(ctx, "kafkaTopicResource", &confluentcloud.KafkaTopicArgs{
    	Credentials: &confluentcloud.KafkaTopicCredentialsArgs{
    		Key:    pulumi.String("string"),
    		Secret: pulumi.String("string"),
    	},
    	HttpEndpoint: pulumi.String("string"),
    	KafkaCluster: &confluentcloud.KafkaTopicKafkaClusterArgs{
    		Id: pulumi.String("string"),
    	},
    	TopicName: pulumi.String("string"),
    	Config: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	PartitionsCount: pulumi.Int(0),
    })
    
    var kafkaTopicResource = new KafkaTopic("kafkaTopicResource", KafkaTopicArgs.builder()
        .credentials(KafkaTopicCredentialsArgs.builder()
            .key("string")
            .secret("string")
            .build())
        .httpEndpoint("string")
        .kafkaCluster(KafkaTopicKafkaClusterArgs.builder()
            .id("string")
            .build())
        .topicName("string")
        .config(Map.of("string", "string"))
        .partitionsCount(0)
        .build());
    
    kafka_topic_resource = confluentcloud.KafkaTopic("kafkaTopicResource",
        credentials={
            "key": "string",
            "secret": "string",
        },
        http_endpoint="string",
        kafka_cluster={
            "id": "string",
        },
        topic_name="string",
        config={
            "string": "string",
        },
        partitions_count=0)
    
    const kafkaTopicResource = new confluentcloud.KafkaTopic("kafkaTopicResource", {
        credentials: {
            key: "string",
            secret: "string",
        },
        httpEndpoint: "string",
        kafkaCluster: {
            id: "string",
        },
        topicName: "string",
        config: {
            string: "string",
        },
        partitionsCount: 0,
    });
    
    type: confluentcloud:KafkaTopic
    properties:
        config:
            string: string
        credentials:
            key: string
            secret: string
        httpEndpoint: string
        kafkaCluster:
            id: string
        partitionsCount: 0
        topicName: string
    

    KafkaTopic 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 KafkaTopic resource accepts the following input properties:

    Credentials Pulumi.ConfluentCloud.Inputs.KafkaTopicCredentials
    The Cluster API Credentials.
    HttpEndpoint string
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    KafkaCluster Pulumi.ConfluentCloud.Inputs.KafkaTopicKafkaCluster
    TopicName string
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    Config Dictionary<string, string>
    The custom topic settings to set:
    PartitionsCount int
    The number of partitions to create in the topic. Defaults to 6.
    Credentials KafkaTopicCredentialsArgs
    The Cluster API Credentials.
    HttpEndpoint string
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    KafkaCluster KafkaTopicKafkaClusterArgs
    TopicName string
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    Config map[string]string
    The custom topic settings to set:
    PartitionsCount int
    The number of partitions to create in the topic. Defaults to 6.
    credentials KafkaTopicCredentials
    The Cluster API Credentials.
    httpEndpoint String
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafkaCluster KafkaTopicKafkaCluster
    topicName String
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config Map<String,String>
    The custom topic settings to set:
    partitionsCount Integer
    The number of partitions to create in the topic. Defaults to 6.
    credentials KafkaTopicCredentials
    The Cluster API Credentials.
    httpEndpoint string
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafkaCluster KafkaTopicKafkaCluster
    topicName string
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config {[key: string]: string}
    The custom topic settings to set:
    partitionsCount number
    The number of partitions to create in the topic. Defaults to 6.
    credentials KafkaTopicCredentialsArgs
    The Cluster API Credentials.
    http_endpoint str
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafka_cluster KafkaTopicKafkaClusterArgs
    topic_name str
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config Mapping[str, str]
    The custom topic settings to set:
    partitions_count int
    The number of partitions to create in the topic. Defaults to 6.
    credentials Property Map
    The Cluster API Credentials.
    httpEndpoint String
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafkaCluster Property Map
    topicName String
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config Map<String>
    The custom topic settings to set:
    partitionsCount Number
    The number of partitions to create in the topic. Defaults to 6.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the KafkaTopic 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 KafkaTopic Resource

    Get an existing KafkaTopic 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?: KafkaTopicState, opts?: CustomResourceOptions): KafkaTopic
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            config: Optional[Mapping[str, str]] = None,
            credentials: Optional[KafkaTopicCredentialsArgs] = None,
            http_endpoint: Optional[str] = None,
            kafka_cluster: Optional[KafkaTopicKafkaClusterArgs] = None,
            partitions_count: Optional[int] = None,
            topic_name: Optional[str] = None) -> KafkaTopic
    func GetKafkaTopic(ctx *Context, name string, id IDInput, state *KafkaTopicState, opts ...ResourceOption) (*KafkaTopic, error)
    public static KafkaTopic Get(string name, Input<string> id, KafkaTopicState? state, CustomResourceOptions? opts = null)
    public static KafkaTopic get(String name, Output<String> id, KafkaTopicState state, CustomResourceOptions options)
    resources:  _:    type: confluentcloud:KafkaTopic    get:      id: ${id}
    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:
    Config Dictionary<string, string>
    The custom topic settings to set:
    Credentials Pulumi.ConfluentCloud.Inputs.KafkaTopicCredentials
    The Cluster API Credentials.
    HttpEndpoint string
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    KafkaCluster Pulumi.ConfluentCloud.Inputs.KafkaTopicKafkaCluster
    PartitionsCount int
    The number of partitions to create in the topic. Defaults to 6.
    TopicName string
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    Config map[string]string
    The custom topic settings to set:
    Credentials KafkaTopicCredentialsArgs
    The Cluster API Credentials.
    HttpEndpoint string
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    KafkaCluster KafkaTopicKafkaClusterArgs
    PartitionsCount int
    The number of partitions to create in the topic. Defaults to 6.
    TopicName string
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config Map<String,String>
    The custom topic settings to set:
    credentials KafkaTopicCredentials
    The Cluster API Credentials.
    httpEndpoint String
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafkaCluster KafkaTopicKafkaCluster
    partitionsCount Integer
    The number of partitions to create in the topic. Defaults to 6.
    topicName String
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config {[key: string]: string}
    The custom topic settings to set:
    credentials KafkaTopicCredentials
    The Cluster API Credentials.
    httpEndpoint string
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafkaCluster KafkaTopicKafkaCluster
    partitionsCount number
    The number of partitions to create in the topic. Defaults to 6.
    topicName string
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config Mapping[str, str]
    The custom topic settings to set:
    credentials KafkaTopicCredentialsArgs
    The Cluster API Credentials.
    http_endpoint str
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafka_cluster KafkaTopicKafkaClusterArgs
    partitions_count int
    The number of partitions to create in the topic. Defaults to 6.
    topic_name str
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.
    config Map<String>
    The custom topic settings to set:
    credentials Property Map
    The Cluster API Credentials.
    httpEndpoint String
    The REST endpoint of the Kafka cluster, for example, https://pkc-00000.us-central1.gcp.confluent.cloud:443).
    kafkaCluster Property Map
    partitionsCount Number
    The number of partitions to create in the topic. Defaults to 6.
    topicName String
    The name of the topic, for example, orders-1. The topic name can be up to 255 characters in length, and can include the following characters: a-z, A-Z, 0-9, . (dot), _ (underscore), and - (dash). As a best practice, we recommend against using any personally identifiable information (PII) when naming your topic.

    Supporting Types

    KafkaTopicCredentials, KafkaTopicCredentialsArgs

    Key string
    The Kafka API Key.
    Secret string
    The Kafka API Secret.
    Key string
    The Kafka API Key.
    Secret string
    The Kafka API Secret.
    key String
    The Kafka API Key.
    secret String
    The Kafka API Secret.
    key string
    The Kafka API Key.
    secret string
    The Kafka API Secret.
    key str
    The Kafka API Key.
    secret str
    The Kafka API Secret.
    key String
    The Kafka API Key.
    secret String
    The Kafka API Secret.

    KafkaTopicKafkaCluster, KafkaTopicKafkaClusterArgs

    Id string
    The ID of the Kafka cluster, for example, lkc-abc123.
    Id string
    The ID of the Kafka cluster, for example, lkc-abc123.
    id String
    The ID of the Kafka cluster, for example, lkc-abc123.
    id string
    The ID of the Kafka cluster, for example, lkc-abc123.
    id str
    The ID of the Kafka cluster, for example, lkc-abc123.
    id String
    The ID of the Kafka cluster, for example, lkc-abc123.

    Package Details

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