1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. alikafka
  5. Topic
Alibaba Cloud v3.88.1 published on Saturday, Nov 8, 2025 by Pulumi
alicloud logo
Alibaba Cloud v3.88.1 published on Saturday, Nov 8, 2025 by Pulumi

    Provides a Alikafka Topic resource.

    Topic in kafka.

    For information about Alikafka Topic and how to use it, see What is Topic.

    NOTE: Available since v1.56.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = alicloud.getZones({
        availableResourceCreation: "VSwitch",
    });
    const defaultNetwork = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "172.16.0.0/12",
    });
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vswitchName: name,
        vpcId: defaultNetwork.id,
        cidrBlock: "172.16.0.0/24",
        zoneId: _default.then(_default => _default.zones?.[0]?.id),
    });
    const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {vpcId: defaultNetwork.id});
    const defaultInstance = new alicloud.alikafka.Instance("default", {
        name: name,
        partitionNum: 50,
        diskType: 1,
        diskSize: 500,
        deployType: 5,
        ioMax: 20,
        specType: "professional",
        serviceVersion: "2.2.0",
        vswitchId: defaultSwitch.id,
        securityGroup: defaultSecurityGroup.id,
        config: JSON.stringify({
            "enable.acl": "true",
        }),
    });
    const defaultTopic = new alicloud.alikafka.Topic("default", {
        instanceId: defaultInstance.id,
        topic: name,
        remark: name,
        localTopic: true,
        compactTopic: true,
        partitionNum: 18,
        configs: JSON.stringify({
            "message.format.version": "2.2.0",
            "max.message.bytes": "10485760",
            "min.insync.replicas": "1",
            "replication-factor": "2",
            "retention.ms": "3600000",
        }),
        tags: {
            Created: "TF",
            For: "example",
        },
    });
    
    import pulumi
    import json
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.get_zones(available_resource_creation="VSwitch")
    default_network = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="172.16.0.0/12")
    default_switch = alicloud.vpc.Switch("default",
        vswitch_name=name,
        vpc_id=default_network.id,
        cidr_block="172.16.0.0/24",
        zone_id=default.zones[0].id)
    default_security_group = alicloud.ecs.SecurityGroup("default", vpc_id=default_network.id)
    default_instance = alicloud.alikafka.Instance("default",
        name=name,
        partition_num=50,
        disk_type=1,
        disk_size=500,
        deploy_type=5,
        io_max=20,
        spec_type="professional",
        service_version="2.2.0",
        vswitch_id=default_switch.id,
        security_group=default_security_group.id,
        config=json.dumps({
            "enable.acl": "true",
        }))
    default_topic = alicloud.alikafka.Topic("default",
        instance_id=default_instance.id,
        topic=name,
        remark=name,
        local_topic=True,
        compact_topic=True,
        partition_num=18,
        configs=json.dumps({
            "message.format.version": "2.2.0",
            "max.message.bytes": "10485760",
            "min.insync.replicas": "1",
            "replication-factor": "2",
            "retention.ms": "3600000",
        }),
        tags={
            "Created": "TF",
            "For": "example",
        })
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alikafka"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("172.16.0.0/12"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VswitchName: pulumi.String(name),
    			VpcId:       defaultNetwork.ID(),
    			CidrBlock:   pulumi.String("172.16.0.0/24"),
    			ZoneId:      pulumi.String(_default.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
    			VpcId: defaultNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"enable.acl": "true",
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		defaultInstance, err := alikafka.NewInstance(ctx, "default", &alikafka.InstanceArgs{
    			Name:           pulumi.String(name),
    			PartitionNum:   pulumi.Int(50),
    			DiskType:       pulumi.Int(1),
    			DiskSize:       pulumi.Int(500),
    			DeployType:     pulumi.Int(5),
    			IoMax:          pulumi.Int(20),
    			SpecType:       pulumi.String("professional"),
    			ServiceVersion: pulumi.String("2.2.0"),
    			VswitchId:      defaultSwitch.ID(),
    			SecurityGroup:  defaultSecurityGroup.ID(),
    			Config:         pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON1, err := json.Marshal(map[string]interface{}{
    			"message.format.version": "2.2.0",
    			"max.message.bytes":      "10485760",
    			"min.insync.replicas":    "1",
    			"replication-factor":     "2",
    			"retention.ms":           "3600000",
    		})
    		if err != nil {
    			return err
    		}
    		json1 := string(tmpJSON1)
    		_, err = alikafka.NewTopic(ctx, "default", &alikafka.TopicArgs{
    			InstanceId:   defaultInstance.ID(),
    			Topic:        pulumi.String(name),
    			Remark:       pulumi.String(name),
    			LocalTopic:   pulumi.Bool(true),
    			CompactTopic: pulumi.Bool(true),
    			PartitionNum: pulumi.Int(18),
    			Configs:      pulumi.String(json1),
    			Tags: pulumi.StringMap{
    				"Created": pulumi.String("TF"),
    				"For":     pulumi.String("example"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "VSwitch",
        });
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "172.16.0.0/12",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VswitchName = name,
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/24",
            ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
        });
    
        var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
        {
            VpcId = defaultNetwork.Id,
        });
    
        var defaultInstance = new AliCloud.AliKafka.Instance("default", new()
        {
            Name = name,
            PartitionNum = 50,
            DiskType = 1,
            DiskSize = 500,
            DeployType = 5,
            IoMax = 20,
            SpecType = "professional",
            ServiceVersion = "2.2.0",
            VswitchId = defaultSwitch.Id,
            SecurityGroup = defaultSecurityGroup.Id,
            Config = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["enable.acl"] = "true",
            }),
        });
    
        var defaultTopic = new AliCloud.AliKafka.Topic("default", new()
        {
            InstanceId = defaultInstance.Id,
            TopicName = name,
            Remark = name,
            LocalTopic = true,
            CompactTopic = true,
            PartitionNum = 18,
            Configs = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["message.format.version"] = "2.2.0",
                ["max.message.bytes"] = "10485760",
                ["min.insync.replicas"] = "1",
                ["replication-factor"] = "2",
                ["retention.ms"] = "3600000",
            }),
            Tags = 
            {
                { "Created", "TF" },
                { "For", "example" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetZonesArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.ecs.SecurityGroup;
    import com.pulumi.alicloud.ecs.SecurityGroupArgs;
    import com.pulumi.alicloud.alikafka.Instance;
    import com.pulumi.alicloud.alikafka.InstanceArgs;
    import com.pulumi.alicloud.alikafka.Topic;
    import com.pulumi.alicloud.alikafka.TopicArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("VSwitch")
                .build());
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .vpcName(name)
                .cidrBlock("172.16.0.0/12")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
                .vswitchName(name)
                .vpcId(defaultNetwork.id())
                .cidrBlock("172.16.0.0/24")
                .zoneId(default_.zones()[0].id())
                .build());
    
            var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
                .vpcId(defaultNetwork.id())
                .build());
    
            var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
                .name(name)
                .partitionNum(50)
                .diskType(1)
                .diskSize(500)
                .deployType(5)
                .ioMax(20)
                .specType("professional")
                .serviceVersion("2.2.0")
                .vswitchId(defaultSwitch.id())
                .securityGroup(defaultSecurityGroup.id())
                .config(serializeJson(
                    jsonObject(
                        jsonProperty("enable.acl", "true")
                    )))
                .build());
    
            var defaultTopic = new Topic("defaultTopic", TopicArgs.builder()
                .instanceId(defaultInstance.id())
                .topic(name)
                .remark(name)
                .localTopic(true)
                .compactTopic(true)
                .partitionNum(18)
                .configs(serializeJson(
                    jsonObject(
                        jsonProperty("message.format.version", "2.2.0"),
                        jsonProperty("max.message.bytes", "10485760"),
                        jsonProperty("min.insync.replicas", "1"),
                        jsonProperty("replication-factor", "2"),
                        jsonProperty("retention.ms", "3600000")
                    )))
                .tags(Map.ofEntries(
                    Map.entry("Created", "TF"),
                    Map.entry("For", "example")
                ))
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultNetwork:
        type: alicloud:vpc:Network
        name: default
        properties:
          vpcName: ${name}
          cidrBlock: 172.16.0.0/12
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vswitchName: ${name}
          vpcId: ${defaultNetwork.id}
          cidrBlock: 172.16.0.0/24
          zoneId: ${default.zones[0].id}
      defaultSecurityGroup:
        type: alicloud:ecs:SecurityGroup
        name: default
        properties:
          vpcId: ${defaultNetwork.id}
      defaultInstance:
        type: alicloud:alikafka:Instance
        name: default
        properties:
          name: ${name}
          partitionNum: 50
          diskType: '1'
          diskSize: '500'
          deployType: '5'
          ioMax: '20'
          specType: professional
          serviceVersion: 2.2.0
          vswitchId: ${defaultSwitch.id}
          securityGroup: ${defaultSecurityGroup.id}
          config:
            fn::toJSON:
              enable.acl: 'true'
      defaultTopic:
        type: alicloud:alikafka:Topic
        name: default
        properties:
          instanceId: ${defaultInstance.id}
          topic: ${name}
          remark: ${name}
          localTopic: 'true'
          compactTopic: 'true'
          partitionNum: '18'
          configs:
            fn::toJSON:
              message.format.version: 2.2.0
              max.message.bytes: '10485760'
              min.insync.replicas: '1'
              replication-factor: '2'
              retention.ms: '3600000'
          tags:
            Created: TF
            For: example
    variables:
      default:
        fn::invoke:
          function: alicloud:getZones
          arguments:
            availableResourceCreation: VSwitch
    

    Create Topic Resource

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

    Constructor syntax

    new Topic(name: string, args: TopicArgs, opts?: CustomResourceOptions);
    @overload
    def Topic(resource_name: str,
              args: TopicArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Topic(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              instance_id: Optional[str] = None,
              remark: Optional[str] = None,
              topic: Optional[str] = None,
              compact_topic: Optional[bool] = None,
              configs: Optional[str] = None,
              local_topic: Optional[bool] = None,
              partition_num: Optional[int] = None,
              tags: Optional[Mapping[str, str]] = None)
    func NewTopic(ctx *Context, name string, args TopicArgs, opts ...ResourceOption) (*Topic, error)
    public Topic(string name, TopicArgs args, CustomResourceOptions? opts = null)
    public Topic(String name, TopicArgs args)
    public Topic(String name, TopicArgs args, CustomResourceOptions options)
    
    type: alicloud:alikafka:Topic
    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 TopicArgs
    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 TopicArgs
    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 TopicArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TopicArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TopicArgs
    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 topicResource = new AliCloud.AliKafka.Topic("topicResource", new()
    {
        InstanceId = "string",
        Remark = "string",
        TopicName = "string",
        CompactTopic = false,
        Configs = "string",
        LocalTopic = false,
        PartitionNum = 0,
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := alikafka.NewTopic(ctx, "topicResource", &alikafka.TopicArgs{
    	InstanceId:   pulumi.String("string"),
    	Remark:       pulumi.String("string"),
    	Topic:        pulumi.String("string"),
    	CompactTopic: pulumi.Bool(false),
    	Configs:      pulumi.String("string"),
    	LocalTopic:   pulumi.Bool(false),
    	PartitionNum: pulumi.Int(0),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var topicResource = new com.pulumi.alicloud.alikafka.Topic("topicResource", com.pulumi.alicloud.alikafka.TopicArgs.builder()
        .instanceId("string")
        .remark("string")
        .topic("string")
        .compactTopic(false)
        .configs("string")
        .localTopic(false)
        .partitionNum(0)
        .tags(Map.of("string", "string"))
        .build());
    
    topic_resource = alicloud.alikafka.Topic("topicResource",
        instance_id="string",
        remark="string",
        topic="string",
        compact_topic=False,
        configs="string",
        local_topic=False,
        partition_num=0,
        tags={
            "string": "string",
        })
    
    const topicResource = new alicloud.alikafka.Topic("topicResource", {
        instanceId: "string",
        remark: "string",
        topic: "string",
        compactTopic: false,
        configs: "string",
        localTopic: false,
        partitionNum: 0,
        tags: {
            string: "string",
        },
    });
    
    type: alicloud:alikafka:Topic
    properties:
        compactTopic: false
        configs: string
        instanceId: string
        localTopic: false
        partitionNum: 0
        remark: string
        tags:
            string: string
        topic: string
    

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

    InstanceId string
    The ID of the instance.
    Remark string
    The description of the topic.
    TopicName string
    The topic name.
    CompactTopic bool
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    Configs string
    The advanced configurations.
    LocalTopic bool
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    PartitionNum int
    The number of partitions in the topic.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    InstanceId string
    The ID of the instance.
    Remark string
    The description of the topic.
    Topic string
    The topic name.
    CompactTopic bool
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    Configs string
    The advanced configurations.
    LocalTopic bool
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    PartitionNum int
    The number of partitions in the topic.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    instanceId String
    The ID of the instance.
    remark String
    The description of the topic.
    topic String
    The topic name.
    compactTopic Boolean
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs String
    The advanced configurations.
    localTopic Boolean
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partitionNum Integer
    The number of partitions in the topic.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    instanceId string
    The ID of the instance.
    remark string
    The description of the topic.
    topic string
    The topic name.
    compactTopic boolean
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs string
    The advanced configurations.
    localTopic boolean
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partitionNum number
    The number of partitions in the topic.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    instance_id str
    The ID of the instance.
    remark str
    The description of the topic.
    topic str
    The topic name.
    compact_topic bool
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs str
    The advanced configurations.
    local_topic bool
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partition_num int
    The number of partitions in the topic.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    instanceId String
    The ID of the instance.
    remark String
    The description of the topic.
    topic String
    The topic name.
    compactTopic Boolean
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs String
    The advanced configurations.
    localTopic Boolean
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partitionNum Number
    The number of partitions in the topic.
    tags Map<String>
    A mapping of tags to assign to the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Topic resource produces the following output properties:

    CreateTime int
    (Available since v1.262.1) The time when the topic was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    RegionId string
    (Available since v1.262.1) The ID of the region where the instance resides.
    Status string
    (Available since v1.262.1) The status of the service.
    CreateTime int
    (Available since v1.262.1) The time when the topic was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    RegionId string
    (Available since v1.262.1) The ID of the region where the instance resides.
    Status string
    (Available since v1.262.1) The status of the service.
    createTime Integer
    (Available since v1.262.1) The time when the topic was created.
    id String
    The provider-assigned unique ID for this managed resource.
    regionId String
    (Available since v1.262.1) The ID of the region where the instance resides.
    status String
    (Available since v1.262.1) The status of the service.
    createTime number
    (Available since v1.262.1) The time when the topic was created.
    id string
    The provider-assigned unique ID for this managed resource.
    regionId string
    (Available since v1.262.1) The ID of the region where the instance resides.
    status string
    (Available since v1.262.1) The status of the service.
    create_time int
    (Available since v1.262.1) The time when the topic was created.
    id str
    The provider-assigned unique ID for this managed resource.
    region_id str
    (Available since v1.262.1) The ID of the region where the instance resides.
    status str
    (Available since v1.262.1) The status of the service.
    createTime Number
    (Available since v1.262.1) The time when the topic was created.
    id String
    The provider-assigned unique ID for this managed resource.
    regionId String
    (Available since v1.262.1) The ID of the region where the instance resides.
    status String
    (Available since v1.262.1) The status of the service.

    Look up Existing Topic Resource

    Get an existing Topic 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?: TopicState, opts?: CustomResourceOptions): Topic
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            compact_topic: Optional[bool] = None,
            configs: Optional[str] = None,
            create_time: Optional[int] = None,
            instance_id: Optional[str] = None,
            local_topic: Optional[bool] = None,
            partition_num: Optional[int] = None,
            region_id: Optional[str] = None,
            remark: Optional[str] = None,
            status: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            topic: Optional[str] = None) -> Topic
    func GetTopic(ctx *Context, name string, id IDInput, state *TopicState, opts ...ResourceOption) (*Topic, error)
    public static Topic Get(string name, Input<string> id, TopicState? state, CustomResourceOptions? opts = null)
    public static Topic get(String name, Output<String> id, TopicState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:alikafka:Topic    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:
    CompactTopic bool
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    Configs string
    The advanced configurations.
    CreateTime int
    (Available since v1.262.1) The time when the topic was created.
    InstanceId string
    The ID of the instance.
    LocalTopic bool
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    PartitionNum int
    The number of partitions in the topic.
    RegionId string
    (Available since v1.262.1) The ID of the region where the instance resides.
    Remark string
    The description of the topic.
    Status string
    (Available since v1.262.1) The status of the service.
    Tags Dictionary<string, string>
    A mapping of tags to assign to the resource.
    TopicName string
    The topic name.
    CompactTopic bool
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    Configs string
    The advanced configurations.
    CreateTime int
    (Available since v1.262.1) The time when the topic was created.
    InstanceId string
    The ID of the instance.
    LocalTopic bool
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    PartitionNum int
    The number of partitions in the topic.
    RegionId string
    (Available since v1.262.1) The ID of the region where the instance resides.
    Remark string
    The description of the topic.
    Status string
    (Available since v1.262.1) The status of the service.
    Tags map[string]string
    A mapping of tags to assign to the resource.
    Topic string
    The topic name.
    compactTopic Boolean
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs String
    The advanced configurations.
    createTime Integer
    (Available since v1.262.1) The time when the topic was created.
    instanceId String
    The ID of the instance.
    localTopic Boolean
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partitionNum Integer
    The number of partitions in the topic.
    regionId String
    (Available since v1.262.1) The ID of the region where the instance resides.
    remark String
    The description of the topic.
    status String
    (Available since v1.262.1) The status of the service.
    tags Map<String,String>
    A mapping of tags to assign to the resource.
    topic String
    The topic name.
    compactTopic boolean
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs string
    The advanced configurations.
    createTime number
    (Available since v1.262.1) The time when the topic was created.
    instanceId string
    The ID of the instance.
    localTopic boolean
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partitionNum number
    The number of partitions in the topic.
    regionId string
    (Available since v1.262.1) The ID of the region where the instance resides.
    remark string
    The description of the topic.
    status string
    (Available since v1.262.1) The status of the service.
    tags {[key: string]: string}
    A mapping of tags to assign to the resource.
    topic string
    The topic name.
    compact_topic bool
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs str
    The advanced configurations.
    create_time int
    (Available since v1.262.1) The time when the topic was created.
    instance_id str
    The ID of the instance.
    local_topic bool
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partition_num int
    The number of partitions in the topic.
    region_id str
    (Available since v1.262.1) The ID of the region where the instance resides.
    remark str
    The description of the topic.
    status str
    (Available since v1.262.1) The status of the service.
    tags Mapping[str, str]
    A mapping of tags to assign to the resource.
    topic str
    The topic name.
    compactTopic Boolean
    The cleanup policy for the topic. This parameter is available only if you set the storage engine of the topic to Local storage. Valid values:

    • false: The delete cleanup policy is used.
    • true: The compact cleanup policy is used.
    configs String
    The advanced configurations.
    createTime Number
    (Available since v1.262.1) The time when the topic was created.
    instanceId String
    The ID of the instance.
    localTopic Boolean
    The storage engine of the topic. Valid values:

    • false: Cloud storage.
    • true: Local storage.
    partitionNum Number
    The number of partitions in the topic.
    regionId String
    (Available since v1.262.1) The ID of the region where the instance resides.
    remark String
    The description of the topic.
    status String
    (Available since v1.262.1) The status of the service.
    tags Map<String>
    A mapping of tags to assign to the resource.
    topic String
    The topic name.

    Import

    Alikafka Topic can be imported using the id, e.g.

    $ pulumi import alicloud:alikafka/topic:Topic example <instance_id>:<topic>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.88.1 published on Saturday, Nov 8, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate