首頁
Terraform
資源列表
Cloud Enterprise Network (CEN)
Resources
alicloud_cen_transit_router_vpc_attachment
alicloud_cen_transit_router_vpc_attachment
更新時間:
Provides a CEN Transit Router VPC Attachment resource that associate the VPC with the CEN instance. What is Cen Transit Router VPC Attachment
-> NOTE: Available since v1.126.0.
Example Usage
Basic Usage
variable "name" {
default = "terraform-example"
}
data "alicloud_cen_transit_router_available_resources" "default" {
}
locals {
master_zone = data.alicloud_cen_transit_router_available_resources.default.resources[0].master_zones[0]
slave_zone = data.alicloud_cen_transit_router_available_resources.default.resources[0].slave_zones[1]
}
resource "alicloud_vpc" "example" {
vpc_name = var.name
cidr_block = "192.168.0.0/16"
}
resource "alicloud_vswitch" "example_master" {
vswitch_name = var.name
cidr_block = "192.168.1.0/24"
vpc_id = alicloud_vpc.example.id
zone_id = local.master_zone
}
resource "alicloud_vswitch" "example_slave" {
vswitch_name = var.name
cidr_block = "192.168.2.0/24"
vpc_id = alicloud_vpc.example.id
zone_id = local.slave_zone
}
resource "alicloud_cen_instance" "example" {
cen_instance_name = var.name
protection_level = "REDUCED"
}
resource "alicloud_cen_transit_router" "example" {
transit_router_name = var.name
cen_id = alicloud_cen_instance.example.id
}
resource "alicloud_cen_transit_router_vpc_attachment" "example" {
cen_id = alicloud_cen_instance.example.id
transit_router_id = alicloud_cen_transit_router.example.transit_router_id
vpc_id = alicloud_vpc.example.id
zone_mappings {
zone_id = local.master_zone
vswitch_id = alicloud_vswitch.example_master.id
}
zone_mappings {
zone_id = local.slave_zone
vswitch_id = alicloud_vswitch.example_slave.id
}
transit_router_attachment_name = var.name
transit_router_attachment_description = var.name
}
Argument Reference
The following arguments are supported:
cen_id
- (Required, ForceNew) The ID of the CEN.vpc_id
- (Required, ForceNew) The ID of the VPC.transit_router_id
- (Optional, ForceNew) The ID of the transit router.resource_type
- (Optional, ForceNew) The resource type of the transit router vpc attachment. Default value:VPC
. Valid values:VPC
.payment_type
- (Optional, ForceNew, Available since v1.168.0) The payment type of the resource. Default value:PayAsYouGo
. Valid values:PayAsYouGo
.vpc_owner_id
- (Optional, ForceNew) The owner id of vpc.auto_publish_route_enabled
- (Optional, Bool, Available since v1.204.0) Whether the transit router is automatically published to the VPC instance. Default value:false
. Valid values:true
: Enable.false
: Disable.
transit_router_attachment_name
- (Optional) The name of the transit router vbr attachment.transit_router_attachment_description
- (Optional) The description of the transit router vbr attachment.zone_mappings
- (Required, Set) The list of zone mapping of the VPC. Seezone_mappings
below. NOTE: From version 1.184.0,zone_mappings
can be modified. -> NOTE: The Zone of CEN has MasterZone and SlaveZone, first zone_id of zone_mapping need be MasterZone. We have a API to describeZonesAPItags
- (Optional, Available since v1.193.1) A mapping of tags to assign to the resource.dry_run
- (Optional, Bool) The dry run.route_table_association_enabled
- (Optional, Bool, Deprecated since v1.192.0) Whether to enabled route table association. NOTE: "Fieldroute_table_association_enabled
has been deprecated from provider version 1.192.0. Please use the resourcealicloud_cen_transit_router_route_table_association
instead, how to use alicloud_cen_transit_router_route_table_association."route_table_propagation_enabled
- (Optional, Bool, Deprecated since v1.192.0) Whether to enabled route table propagation. NOTE: "Fieldroute_table_propagation_enabled
has been deprecated from provider version 1.192.0. Please use the resourcealicloud_cen_transit_router_route_table_propagation
instead, how to use alicloud_cen_transit_router_route_table_propagation."
zone_mappings
The zone_mappings supports the following:
vswitch_id
- (Optional, ForceNew) The VSwitch id of attachment.zone_id
- (Optional, ForceNew) The zone Id of VSwitch.
Attributes Reference
The following attributes are exported:
id
- The resource ID in terraform of Transit Router VPC Attachment. It formats as<cen_id>:<transit_router_attachment_id>
.transit_router_attachment_id
- The ID of the Transit Router Attachment.status
- The associating status of the network.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 3 mins) Used when creating the cen transit router vpc attachment (until it reaches the initialAttached
status).update
- (Defaults to 3 mins) Used when update the cen transit router vpc attachment.delete
- (Defaults to 3 mins) Used when delete the cen transit router vpc attachment.
Import
CEN Transit Router VPC Attachment can be imported using the id, e.g.
$ terraform import alicloud_cen_transit_router_vpc_attachment.example <cen_id>:<transit_router_attachment_id>
文檔內容是否對您有幫助?