文档

alicloud_alikafka_topic

更新时间:
一键部署

Provides an ALIKAFKA topic resource, see What is Alikafka topic .

-> NOTE: Available since v1.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,cn-chengdu,cn-heyuan,ap-southeast-1,ap-southeast-3,ap-southeast-5,ap-northeast-1,eu-central-1,eu-west-1,us-west-1,us-east-1]

Example Usage

Basic Usage

variable "instance_name" {
  default = "tf-example"
}

data "alicloud_zones" "default" {
  available_resource_creation = "VSwitch"
}

resource "random_integer" "default" {
  min = 10000
  max = 99999
}

resource "alicloud_vpc" "default" {
  cidr_block = "172.16.0.0/12"
}

resource "alicloud_vswitch" "default" {
  vpc_id     = alicloud_vpc.default.id
  cidr_block = "172.16.0.0/24"
  zone_id    = data.alicloud_zones.default.zones[0].id
}

resource "alicloud_security_group" "default" {
  vpc_id = alicloud_vpc.default.id
}

resource "alicloud_alikafka_instance" "default" {
  name           = "${var.instance_name}-${random_integer.default.result}"
  partition_num  = "50"
  disk_type      = "1"
  disk_size      = "500"
  deploy_type    = "5"
  io_max         = "20"
  vswitch_id     = alicloud_vswitch.default.id
  security_group = alicloud_security_group.default.id
}

resource "alicloud_alikafka_topic" "default" {
  instance_id   = alicloud_alikafka_instance.default.id
  topic         = "example-topic"
  local_topic   = "false"
  compact_topic = "false"
  partition_num = "12"
  remark        = "dafault_kafka_topic_remark"
}

Argument Reference

The following arguments are supported:

  • instance_id - (Required, ForceNew) InstanceId of your Kafka resource, the topic will create in this instance.
  • topic - (Required, ForceNew) Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 249 characters.
  • local_topic - (Optional, ForceNew) Whether the topic is localTopic or not.
  • compact_topic - (Optional, ForceNew) Whether the topic is compactTopic or not. Compact topic must be a localTopic.
  • partition_num - (Optional) The number of partitions of the topic. The number should between 1 and 48.
  • remark - (Required) This attribute is a concise description of topic. The length cannot exceed 64.
  • tags - (Optional, Available in v1.63.0+) A mapping of tags to assign to the resource.

Attributes Reference

The following attributes are exported:

  • id - The key of the resource supplied above. The value is formulated as <instance_id>:<topic>.

Import

ALIKAFKA TOPIC can be imported using the id, e.g.

$ terraform import alicloud_alikafka_topic.topic alikafka_post-cn-123455abc:topicName

Timeouts

-> NOTE: Available since v1.119.0.

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 10 mins) Used when creating the topic (until it reaches the initial Running status).

  • 本页导读 (0)
文档反馈