Topic

Provides an ALIKAFKA topic resource.

NOTE: Available in 1.56.0+

NOTE: Only the following regions support create alikafka topic. [cn-hangzhou,cn-beijing,cn-shenzhen,cn-shanghai,cn-qingdao,cn-hongkong,cn-huhehaote,cn-zhangjiakou,ap-southeast-1,ap-south-1,ap-southeast-5]

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var defaultZones = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableResourceCreation = "VSwitch",
        }));
        var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/12",
        });
        var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new AliCloud.Vpc.SwitchArgs
        {
            AvailabilityZone = defaultZones.Apply(defaultZones => defaultZones.Zones[0].Id),
            CidrBlock = "172.16.0.0/24",
            VpcId = defaultNetwork.Id,
        });
        var defaultInstance = new AliCloud.AliKafka.Instance("defaultInstance", new AliCloud.AliKafka.InstanceArgs
        {
            DeployType = 5,
            DiskSize = 500,
            DiskType = 1,
            IoMax = 20,
            TopicQuota = 50,
            VswitchId = defaultSwitch.Id,
        });
        var config = new Config();
        var topic = config.Get("topic") ?? "alikafkaTopicName";
        var defaultTopic = new AliCloud.AliKafka.Topic("defaultTopic", new AliCloud.AliKafka.TopicArgs
        {
            CompactTopic = false,
            InstanceId = defaultInstance.Id,
            LocalTopic = false,
            PartitionNum = 12,
            Remark = "dafault_kafka_topic_remark",
            Topic = topic,
        });
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

default_zones = alicloud.get_zones(available_resource_creation="VSwitch")
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/12")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    availability_zone=default_zones.zones[0]["id"],
    cidr_block="172.16.0.0/24",
    vpc_id=default_network.id)
default_instance = alicloud.alikafka.Instance("defaultInstance",
    deploy_type="5",
    disk_size="500",
    disk_type="1",
    io_max="20",
    topic_quota="50",
    vswitch_id=default_switch.id)
config = pulumi.Config()
topic = config.get("topic")
if topic is None:
    topic = "alikafkaTopicName"
default_topic = alicloud.alikafka.Topic("defaultTopic",
    compact_topic="false",
    instance_id=default_instance.id,
    local_topic="false",
    partition_num="12",
    remark="dafault_kafka_topic_remark",
    topic=topic)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const topic = config.get("topic") || "alikafkaTopicName";

const defaultZones = pulumi.output(alicloud.getZones({
    availableResourceCreation: "VSwitch",
}, { async: true }));
const defaultNetwork = new alicloud.vpc.Network("default", {
    cidrBlock: "172.16.0.0/12",
});
const defaultSwitch = new alicloud.vpc.Switch("default", {
    availabilityZone: defaultZones.zones[0].id,
    cidrBlock: "172.16.0.0/24",
    vpcId: defaultNetwork.id,
});
const defaultInstance = new alicloud.alikafka.Instance("default", {
    deployType: 5,
    diskSize: 500,
    diskType: 1,
    ioMax: 20,
    topicQuota: 50,
    vswitchId: defaultSwitch.id,
});
const defaultTopic = new alicloud.alikafka.Topic("default", {
    compactTopic: false,
    instanceId: defaultInstance.id,
    localTopic: false,
    partitionNum: 12,
    remark: "dafault_kafka_topic_remark",
    topic: topic,
});

Create a Topic Resource

new Topic(name: string, args: TopicArgs, opts?: CustomResourceOptions);
def Topic(resource_name, opts=None, compact_topic=None, instance_id=None, local_topic=None, partition_num=None, remark=None, tags=None, topic=None, __props__=None);
func NewTopic(ctx *Context, name string, args TopicArgs, opts ...ResourceOption) (*Topic, error)
public Topic(string name, TopicArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Topic Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Topic resource accepts the following input properties:

InstanceId string

InstanceId of your Kafka resource, the topic will create in this instance.

Remark string

This attribute is a concise description of topic. The length cannot exceed 64.

TopicName string

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

CompactTopic bool

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

LocalTopic bool

Whether the topic is localTopic or not.

PartitionNum int

The number of partitions of the topic. The number should between 1 and 48.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

InstanceId string

InstanceId of your Kafka resource, the topic will create in this instance.

Remark string

This attribute is a concise description of topic. The length cannot exceed 64.

Topic string

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

CompactTopic bool

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

LocalTopic bool

Whether the topic is localTopic or not.

PartitionNum int

The number of partitions of the topic. The number should between 1 and 48.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

instanceId string

InstanceId of your Kafka resource, the topic will create in this instance.

remark string

This attribute is a concise description of topic. The length cannot exceed 64.

topic string

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

compactTopic boolean

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

localTopic boolean

Whether the topic is localTopic or not.

partitionNum number

The number of partitions of the topic. The number should between 1 and 48.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

instance_id str

InstanceId of your Kafka resource, the topic will create in this instance.

remark str

This attribute is a concise description of topic. The length cannot exceed 64.

topic str

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

compact_topic bool

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

local_topic bool

Whether the topic is localTopic or not.

partition_num float

The number of partitions of the topic. The number should between 1 and 48.

tags Dict[str, Any]

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:

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.

Look up an 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
static get(resource_name, id, opts=None, compact_topic=None, instance_id=None, local_topic=None, partition_num=None, remark=None, tags=None, topic=None, __props__=None);
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)
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.

The following state arguments are supported:

CompactTopic bool

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

InstanceId string

InstanceId of your Kafka resource, the topic will create in this instance.

LocalTopic bool

Whether the topic is localTopic or not.

PartitionNum int

The number of partitions of the topic. The number should between 1 and 48.

Remark string

This attribute is a concise description of topic. The length cannot exceed 64.

Tags Dictionary<string, object>

A mapping of tags to assign to the resource.

TopicName string

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

CompactTopic bool

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

InstanceId string

InstanceId of your Kafka resource, the topic will create in this instance.

LocalTopic bool

Whether the topic is localTopic or not.

PartitionNum int

The number of partitions of the topic. The number should between 1 and 48.

Remark string

This attribute is a concise description of topic. The length cannot exceed 64.

Tags map[string]interface{}

A mapping of tags to assign to the resource.

Topic string

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

compactTopic boolean

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

instanceId string

InstanceId of your Kafka resource, the topic will create in this instance.

localTopic boolean

Whether the topic is localTopic or not.

partitionNum number

The number of partitions of the topic. The number should between 1 and 48.

remark string

This attribute is a concise description of topic. The length cannot exceed 64.

tags {[key: string]: any}

A mapping of tags to assign to the resource.

topic string

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

compact_topic bool

Whether the topic is compactTopic or not. Compact topic must be a localTopic.

instance_id str

InstanceId of your Kafka resource, the topic will create in this instance.

local_topic bool

Whether the topic is localTopic or not.

partition_num float

The number of partitions of the topic. The number should between 1 and 48.

remark str

This attribute is a concise description of topic. The length cannot exceed 64.

tags Dict[str, Any]

A mapping of tags to assign to the resource.

topic str

Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.