alicloud_rocketmq_acl

更新时间:

Provides a RocketMQ Acl resource.

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

-> NOTE: Available since v1.245.0.

Example Usage

Basic Usage


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

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

resource "alicloud_vpc" "defaultrqDtGm" {
  description = "1111"
  cidr_block  = "192.168.0.0/16"
  vpc_name    = "pop-example-vpc"
}

resource "alicloud_vswitch" "defaultjUrTYm" {
  vpc_id       = alicloud_vpc.defaultrqDtGm.id
  zone_id      = "cn-hangzhou-j"
  cidr_block   = "192.168.0.0/24"
  vswitch_name = "pop-example-vswitch"
}

resource "alicloud_rocketmq_instance" "defaultKJZNVM" {
  product_info {
    msg_process_spec       = "rmq.p2.4xlarge"
    send_receive_ratio     = "0.3"
    message_retention_time = "70"
  }
  service_code    = "rmq"
  series_code     = "professional"
  payment_type    = "PayAsYouGo"
  instance_name   = var.name
  sub_series_code = "cluster_ha"
  remark          = "example"
  network_info {
    vpc_info {
      vpc_id = alicloud_vpc.defaultrqDtGm.id
      vswitches {
        vswitch_id = alicloud_vswitch.defaultjUrTYm.id
      }
    }
    internet_info {
      internet_spec      = "enable"
      flow_out_type      = "payByBandwidth"
      flow_out_bandwidth = "5"
    }
  }
  acl_info {
    default_vpc_auth_free = false
    acl_types             = ["default", "apache_acl"]
  }
}

resource "alicloud_rocketmq_account" "defaultMeNlxe" {
  account_status = "ENABLE"
  instance_id    = alicloud_rocketmq_instance.defaultKJZNVM.id
  username       = "tfexample"
  password       = "123456"
}

resource "alicloud_rocketmq_topic" "defaultVA0zog" {
  instance_id  = alicloud_rocketmq_instance.defaultKJZNVM.id
  message_type = "NORMAL"
  topic_name   = "tfexample"
}

resource "alicloud_rocketmq_acl" "default" {
  actions       = ["Pub", "Sub"]
  instance_id   = alicloud_rocketmq_instance.defaultKJZNVM.id
  username      = alicloud_rocketmq_account.defaultMeNlxe.username
  resource_name = alicloud_rocketmq_topic.defaultVA0zog.topic_name
  resource_type = "Topic"
  decision      = "Deny"
  ip_whitelists = ["192.168.5.5"]
}

Argument Reference

The following arguments are supported:

  • actions - (Required, List) The type of operations that can be performed on the resource. Valid values:
    • If resource_type is set to Topic. Valid values: Pub, Sub.
    • If resource_type is set to Group. Valid values: Sub.
  • decision - (Required) The decision result of the authorization. Valid values: Deny, Allow.
  • instance_id - (Required, ForceNew) The instance ID.
  • ip_whitelists - (Optional, List) The IP address whitelists.
  • resource_name - (Required, ForceNew) The name of the resource on which you want to grant permissions.
  • resource_type - (Required, ForceNew) The type of the resource on which you want to grant permissions. Valid values: Group, Topic.
  • username - (Required, ForceNew) The username of the account.

Attributes Reference

The following attributes are exported:

  • id - The resource ID in terraform of Acl. It formats as <instance_id>:<username>:<resource_type>:<resource_name>.

Timeouts

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

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

Import

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

$ terraform import alicloud_rocketmq_acl.example <instance_id>:<username>:<resource_type>:<resource_name>