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-chengdu"
}

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" {
  auto_renew_period = "1"
  product_info {
    msg_process_spec       = "rmq.p2.4xlarge"
    send_receive_ratio     = 0.3
    message_retention_time = "70"
  }
  network_info {
    vpc_info {
      vpc_id     = alicloud_vpc.createVpc.id
      vswitch_id = alicloud_vswitch.createVswitch.id
    }
    internet_info {
      internet_spec      = "enable"
      flow_out_type      = "payByBandwidth"
      flow_out_bandwidth = "30"
    }
  }
  period          = "1"
  sub_series_code = "cluster_ha"
  remark          = "example"
  instance_name   = var.name

  service_code = "rmq"
  series_code  = "professional"
  payment_type = "PayAsYouGo"
  period_unit  = "Month"
}

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.
  • 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.
  • 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>