aws_network_interface

Provides an Elastic network interface (ENI) resource.

Example Usage

resource "aws_network_interface" "test" {
  subnet_id       = "${aws_subnet.public_a.id}"
  private_ips     = ["10.0.0.50"]
  security_groups = ["${aws_security_group.web.id}"]

  attachment {
    instance     = "${aws_instance.test.id}"
    device_index = 1
  }
}

Argument Reference

The following arguments are supported:

  • subnet_id - (Required) Subnet ID to create the ENI in.
  • description - (Optional) A description for the network interface.
  • private_ips - (Optional) List of private IPs to assign to the ENI.
  • private_ips_count - (Optional) Number of private IPs to assign to the ENI.
  • security_groups - (Optional) List of security group IDs to assign to the ENI.
  • attachment - (Optional) Block to define the attachment of the ENI. Documented below.
  • source_dest_check - (Optional) Whether to enable source destination checking for the ENI. Default true.
  • tags - (Optional) A mapping of tags to assign to the resource.

The attachment block supports:

  • instance - (Required) ID of the instance to attach to.
  • device_index - (Required) Integer to define the devices index.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

Network Interfaces can be imported using the id, e.g.

$ terraform import aws_network_interface.test eni-e5aa89a3

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/network_interface.html