» alicloud_ons_topics

This data source provides a list of ONS Topics in an Alibaba Cloud account according to the specified filters.

» Example Usage

variable "name" {
  default = "onsInstanceName"
}

variable "topic" {
  default = "onsTopicDatasourceName"
}

resource "alicloud_ons_instance" "default" {
  name = "${var.name}"
  remark = "default_ons_instance_remark"
}

resource "alicloud_ons_topic" "default" {
  topic = "${var.topic}"
  instance_id = "${alicloud_ons_instance.default.id}"
  message_type = 0
  remark = "dafault_ons_topic_remark"
}

data "alicloud_ons_topics" "topics_ds" {
  instance_id = "${alicloud_ons_topic.default.instance_id}"
  name_regex = "${var.topic}"
  output_file = "topics.txt"
}

output "first_topic_name" {
  value = "${data.alicloud_ons_topics.topics_ds.topics.0.topic}"
}

» Argument Reference

The following arguments are supported:

  • instance_id - (Required) ID of the ONS Instance that owns the topics.
  • name_regex - (Optional) A regex string to filter results by the topic name.
  • output_file - (Optional) File name where to save data source results (after running terraform plan).

» Attributes Reference

The following attributes are exported in addition to the arguments listed above: