alicloud_rocketmq_topic

更新时间:

Provides a RocketMQ Topic resource.

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

-> NOTE: Available since v1.211.0.

Example Usage

Basic Usage


variable "name" {
  default = "terraform-example"
}

provider "alicloud" {
  region = "cn-hangzhou"
}

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

resource "alicloud_vpc" "createVpc" {
  description = "example"
  cidr_block  = "172.16.0.0/12"
  vpc_name    = var.name
}

resource "alicloud_vswitch" "createVswitch" {
  description  = "example"
  vpc_id       = alicloud_vpc.createVpc.id
  zone_id      = data.alicloud_zones.default.zones.0.id
  cidr_block   = "172.16.0.0/24"
  vswitch_name = var.name
}

resource "alicloud_rocketmq_instance" "createInstance" {
  product_info {
    msg_process_spec       = "rmq.u2.10xlarge"
    send_receive_ratio     = "0.3"
    message_retention_time = "70"
  }
  service_code    = "rmq"
  payment_type    = "PayAsYouGo"
  instance_name   = var.name
  sub_series_code = "cluster_ha"
  remark          = "example"
  ip_whitelists   = ["192.168.0.0/16", "10.10.0.0/16", "172.168.0.0/16"]
  software {
    maintain_time = "02:00-06:00"
  }
  tags = {
    Created = "TF"
    For     = "example"
  }
  series_code = "ultimate"
  network_info {
    vpc_info {
      vpc_id = alicloud_vpc.createVpc.id
      vswitches {
        vswitch_id = alicloud_vswitch.createVswitch.id
      }
    }
    internet_info {
      internet_spec      = "enable"
      flow_out_type      = "payByBandwidth"
      flow_out_bandwidth = "30"
    }
  }
}

resource "alicloud_rocketmq_topic" "default" {
  remark       = "example"
  instance_id  = alicloud_rocketmq_instance.createInstance.id
  message_type = "NORMAL"
  topic_name   = var.name
}

Argument Reference

The following arguments are supported:

  • instance_id - (Required, ForceNew) Instance ID.
  • max_send_tps - (Optional, Int, Available since v1.247.0) The maximum TPS for message sending.
  • message_type - (Optional, ForceNew) Message type.
  • remark - (Optional) Custom remarks.
  • topic_name - (Required, ForceNew) Topic name and identification.

Attributes Reference

The following attributes are exported:

  • id - The ID of the resource supplied above.The value is formulated as <instance_id>:<topic_name>.
  • create_time - The creation time of the resource.
  • region_id - (Available since v1.247.0) The region ID to which the instance belongs.
  • status - The status of the resource.

Timeouts

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

  • create - (Defaults to 5 mins) Used when create the Topic.
  • delete - (Defaults to 5 mins) Used when delete the Topic.
  • update - (Defaults to 5 mins) Used when update the Topic.

Import

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

$ terraform import alicloud_rocketmq_topic.example <instance_id>:<topic_name>