» alicloud_router_interface_connection

Provides a VPC router interface connection resource to connect two router interfaces which are in two different VPCs. After that, all of the two router interfaces will be active.

» Example Usage


provider "alicloud" {
  region = "${var.region}"
}
variable "region" {
  default = "cn-hangzhou"
}
variable "name" {
  default = "alicloudRouterInterfaceConnectionBasic"
}
resource "alicloud_vpc" "foo" {
  name       = "${var.name}"
  cidr_block = "172.16.0.0/12"
}
resource "alicloud_vpc" "bar" {
  provider   = "alicloud"
  name       = "${var.name}"
  cidr_block = "192.168.0.0/16"
}
resource "alicloud_router_interface" "initiate" {
  opposite_region      = "${var.region}"
  router_type          = "VRouter"
  router_id            = "${alicloud_vpc.foo.router_id}"
  role                 = "InitiatingSide"
  specification        = "Large.2"
  name                 = "${var.name}"
  description          = "${var.name}"
  instance_charge_type = "PostPaid"
}
resource "alicloud_router_interface" "opposite" {
  provider        = "alicloud"
  opposite_region = "${var.region}"
  router_type     = "VRouter"
  router_id       = "${alicloud_vpc.bar.router_id}"
  role            = "AcceptingSide"
  specification   = "Large.1"
  name            = "${var.name}-opposite"
  description     = "${var.name}-opposite"
}

// A integrated router interface connection tunnel requires both InitiatingSide and AcceptingSide configuring opposite router interface.
resource "alicloud_router_interface_connection" "foo" {
  interface_id          = "${alicloud_router_interface.initiate.id}"
  opposite_interface_id = "${alicloud_router_interface.opposite.id}"
  depends_on            = ["alicloud_router_interface_connection.bar"] // The connection must start from the accepting side.
}
resource "alicloud_router_interface_connection" "bar" {
  provider              = "alicloud"
  interface_id          = "${alicloud_router_interface.opposite.id}"
  opposite_interface_id = "${alicloud_router_interface.initiate.id}"
}

» Argument Reference

The following arguments are supported:

  • interface_id - (Required, ForceNew) One side router interface ID.
  • opposite_interface_id - (Required, ForceNew) Another side router interface ID. It must belong the specified "opposite_interface_owner_id" account.
  • opposite_interface_owner_id - (Optional, ForceNew) Another side router interface account ID. Log on to the Alibaba Cloud console, select User Info > Account Management to check the account ID. Default to Provider account_id.
  • opposite_router_id - (Optional, ForceNew) Another side router ID. It must belong the specified "opposite_interface_owner_id" account. It is valid when field "opposite_interface_owner_id" is specified.
  • opposite_router_type - (Optional, ForceNew) Another side router Type. Optional value: VRouter, VBR. It is valid when field "opposite_interface_owner_id" is specified.

» Attributes Reference

The following attributes are exported:

  • id - Router interface ID. The value is equal to "interface_id".

» Import

The router interface connection can be imported using the id, e.g.

$ terraform import alicloud_router_interface_connection.foo ri-abc123456