Provides a VPC Peer Connection resource.
For information about VPC Peer Connection and how to use it, see What is Peer Connection.
Basic Usage
data "alicloud_account" "default" {
}
variable "accepting_region" {
default = "cn-beijing"
}
provider "alicloud" {
alias = "local"
region = "cn-hangzhou"
}
provider "alicloud" {
alias = "accepting"
region = var.accepting_region
}
resource "alicloud_vpc" "local_vpc" {
provider = alicloud.local
vpc_name = "terraform-example"
cidr_block = "172.17.3.0/24"
}
resource "alicloud_vpc" "accepting_vpc" {
provider = alicloud.accepting
vpc_name = "terraform-example"
cidr_block = "172.17.3.0/24"
}
resource "alicloud_vpc_peer_connection" "default" {
provider = alicloud.local
peer_connection_name = "terraform-example"
vpc_id = alicloud_vpc.local_vpc.id
accepting_ali_uid = data.alicloud_account.default.id
accepting_region_id = var.accepting_region
accepting_vpc_id = alicloud_vpc.accepting_vpc.id
description = "terraform-example"
}
The following arguments are supported:
vpc_id
- (Required, ForceNew) The ID of the requester VPC.accepting_vpc_id
- (Required, ForceNew) The VPC ID of the receiving end of the VPC peer connection.accepting_region_id
- (Required, ForceNew) The region ID of the recipient of the VPC peering connection to be created.
accepting_ali_uid
- (Optional, ForceNew, Int) The ID of the Alibaba Cloud account (primary account) of the receiving end of the VPC peering connection to be created.
The following attributes are exported:
id
- The ID of the resource supplied above.create_time
- The creation time of the VPC peer connection. Use UTC time in the format YYYY-MM-DDThh:mm:ssZ
.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 mins) Used when create the Peer Connection.update
- (Defaults to 5 mins) Used when update the Peer Connection.delete
- (Defaults to 5 mins) Used when delete the Peer Connection.VPC Peer Connection can be imported using the id, e.g.
$ terraform import alicloud_vpc_peer_connection.example <id>