» alicloud_network_interface

Provides an ECS Elastic Network Interface resource.

For information about Elastic Network Interface and how to use it, see Elastic Network Interface.

» Example Usage

variable "name" {
  default = "networkInterfaceName"
}

resource "alicloud_vpc" "vpc" {
  name       = "${var.name}"
  cidr_block = "192.168.0.0/24"
}

data "alicloud_zones" "default" {
  available_resource_creation = "VSwitch"
}

resource "alicloud_vswitch" "vswitch" {
  name              = "${var.name}"
  cidr_block        = "192.168.0.0/24"
  availability_zone = "${data.alicloud_zones.default.zones.0.id}"
  vpc_id            = "${alicloud_vpc.vpc.id}"
}

resource "alicloud_security_group" "group" {
  name   = "${var.name}"
  vpc_id = "${alicloud_vpc.vpc.id}"
}

resource "alicloud_network_interface" "default" {
  name              = "${var.name}%d"
  vswitch_id        = "${alicloud_vswitch.vswitch.id}"
  security_groups   = ["${alicloud_security_group.group.id}"]
  private_ip        = "192.168.0.2"
  private_ips_count = 3
}

» Argument Reference

The following arguments are supported:

  • vswitch_id - (Required, ForceNew) The VSwitch to create the ENI in.
  • security_groups - (Require) A list of security group ids to associate with.
  • private_ip - (Optional, ForceNew) The primary private IP of the ENI.
  • name - (Optional) Name of the ENI. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-", ".", "_", and must not begin or end with a hyphen, and must not begin with http:// or https://. Default value is null.
  • description - (Optional) Description of the ENI. This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
  • private_ips - (Optional) List of secondary private IPs to assign to the ENI. Don't use both private_ips and private_ips_count in the same ENI resource block.
  • private_ips_count - (Optional) Number of secondary private IPs to assign to the ENI. Don't use both private_ips and private_ips_count in the same ENI resource block.
  • tags - (Optional) A mapping of tags to assign to the resource.

» Attributes Reference

The following attributes are exported:

  • id - The ENI ID.
  • mac - (Available in 1.54.0+) The MAC address of an ENI.

» Import

ENI can be imported using the id, e.g.

$ terraform import alicloud_network_interface.eni eni-abc1234567890000