alicloud_ddoscoo_port
Provides a Ddos Coo Port resource.
For information about Anti-DDoS Pro Port and how to use it, see What is Port.
-> NOTE: Available since v1.123.0.
Example Usage
Basic Usage
provider "alicloud" {
region = "cn-hangzhou"
}
variable "name" {
default = "tf-example"
}
resource "alicloud_ddoscoo_instance" "default" {
name = var.name
bandwidth = "30"
base_bandwidth = "30"
service_bandwidth = "100"
port_count = "50"
domain_count = "50"
period = "1"
product_type = "ddoscoo"
}
resource "alicloud_ddoscoo_port" "default" {
instance_id = alicloud_ddoscoo_instance.default.id
frontend_port = "7001"
backend_port = "7002"
frontend_protocol = "tcp"
real_servers = ["1.1.1.1", "2.2.2.2"]
}
Argument Reference
The following arguments are supported:
-
backend_port
- (Optional, ForceNew) The port of the origin server. Valid values:0
to65535
. -
config
- (Optional, List, Available since v1.230.0) Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.PersistenceTimeout
: is of Integer type and is required. The timeout period of the session. Value range:30
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
-
frontend_port
- (Required, ForceNew, Int) The forwarding port to query. Valid values:0
to65535
. -
frontend_protocol
- (Required, ForceNew) The type of the forwarding protocol to query. Valid values:tcp
udp
-
instance_id
- (Required, ForceNew) The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.
-> NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.
real_servers
- (Required, List) List of source IP addresses
config
The config supports the following:
persistence_timeout
- (Optional, Int, Available since v1.230.0) The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.
Attributes Reference
The following attributes are exported:
id
- The ID of the resource supplied above.The value is formulated as<instance_id>:<frontend_port>:<frontend_protocol>
.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 mins) Used when create the Port.delete
- (Defaults to 5 mins) Used when delete the Port.update
- (Defaults to 5 mins) Used when update the Port.
Import
Ddos Coo Port can be imported using the id, e.g.
$ terraform import alicloud_ddoscoo_port.example <instance_id>:<frontend_port>:<frontend_protocol>