» alicloud_route_table_attachment
Provides an Alicloud Route Table Attachment resource for associating Route Table to VSwitch Instance.
NOTE: Terraform will auto build route table attachment while it uses alicloud_route_table_attachment
to build a route table attachment resource.
For information about route table and how to use it, see What is Route Table.
» Example Usage
Basic Usage
resource "alicloud_vpc" "foo" {
cidr_block = "172.16.0.0/12"
name = "route_table_attachment"
}
data "alicloud_zones" "default" {
"available_resource_creation"= "VSwitch"
}
resource "alicloud_vswitch" "foo" {
vpc_id = "${alicloud_vpc.foo.id}"
cidr_block = "172.16.0.0/21"
availability_zone = "${data.alicloud_zones.default.zones.0.id}"
name = "route_table_attachment"
}
resource "alicloud_route_table" "foo" {
vpc_id = "${alicloud_vpc.foo.id}"
name = "route_table_attachment"
description = "route_table_attachment"
}
resource "alicloud_route_table_attachment" "foo" {
vswitch_id = "${alicloud_vswitch.foo.id}"
route_table_id = "${alicloud_route_table.foo.id}"
}
» Argument Reference
The following arguments are supported:
-
vswitch_id
- (Required, ForceNew) The vswitch_id of the route table attachment, the field can't be changed. -
route_table_id
- (Required, ForceNew) The route_table_id of the route table attachment, the field can't be changed.
» Attributes Reference
The following attributes are exported:
-
id
- The ID of the route table attachment id and formates as<route_table_id>:<vswitch_id>
.
» Import
The route table attachemnt can be imported using the id, e.g.
$ terraform import alicloud_route_table_attachment.foo vtb-abc123456:vsw-abc123456