hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
42.49k stars 9.52k forks source link

Specify network interface to use when launching instance #2998

Closed choosy closed 7 years ago

choosy commented 9 years ago

There needs to be a way to indicate the network interface to use when launching an instance. This way, the default (eth0) network interface of the instance could be the one indicated. Otherwise, a later attached network interface will be added on top of the default one.

catsby commented 9 years ago

I looks like we can do this by adding a network_interface attribute to Instance, and specifying the NetworkInterfaceId in the InstanceNetworkInterfaceSpecification

choosy commented 9 years ago

@catsby, actually it is not the same thing with the one I am requesting. I am already using the InstanceNetworkInterface specification to attach an eni to an instance. But when creating an instance, aws already makes an eni, before you attach anything. So when you attach something, you will end up with a second eni. So for example by default, if you use device_index = 0 in the eni-instance attachment, you will have an error like:

if you use other device_index, you will get two enis, even if you only need one. And if for example you want to attach to enis, like we need in our scenario, you won't be able. Because you will have three in total (two plus the default one), and aws has a limit on this.

That is why, the aws api call for creating an instance have a specific parameter for indicating an ani. That's the default and first eni with which the instance start. Whatever attachements you do afterwards, come on top of that.

joelmoss commented 9 years ago

@catsby This is really annoying for me. Would like to help here if I can. Any chance you can point me in the right direction?

pikeas commented 8 years ago

+1, I'm setting up some critical instances (eg, Kubernetes master) that should have ENIs in case they ever fall over. My options are a) create instance with auto ENI and manually turn off the ENI's "Delete on terminate" attribute, or b) attach a second ENI to every instance, leaving the original eth0 dangling per @choosy and preventing the use of an additional ENI.

It would be much easier if I could specify the ENI on instance creation, and this is already supported by the AWS API.

fattyuke commented 8 years ago

I just ran into this as well. I would prefer to assign eth0 to an end I create. I've got 2 ENIs that get created, but I end up with a total of 3 interfaces on the instance. I would prefer just two. I can do this via the AWS cli as well as cloudformation. Has there been any work done on this?

aberrios85 commented 8 years ago

Hi, also hitting up against this. Just wondering if there's much movement on the issue.

aaroncaito commented 8 years ago

Also needing this - and can we use it from within a aws_launch_configuration?

zzzuzik commented 8 years ago

+1

Andy--Rose commented 8 years ago

+1

Trying to set up a Netscaler instance, which needs 3 ENIs to access the 3 subnets. 3 is the maximum and I tried to attach 4 ENIs to get around this missing feature, but that will not work. I need to associate an EIP to the default (eth0) ENI, but there is no way to attach an ENI to eth0, overriding the existing ENI.

Alternatively, if I could access the id of the ENI created with the instance (eth0), I would be able to attach the EIP directly to it without the need to replace it.

lbernail commented 7 years ago

+1 This would be great and solve issue #1557 (probably better this solution is more generic)

cmonaghan commented 7 years ago

+1. I'm hitting up against this too.

rjinski commented 7 years ago

+1

thallam08 commented 7 years ago

Also have the same issue. The link from instance to its interfaces needs be maintained.

geoffles commented 7 years ago

+1 please!

evan-glick commented 7 years ago

+1. Experiencing same issue with indicating the network interface to use when launching an instance, and wanting to be able to Tag/Name this default Network Interface.

acholt commented 7 years ago

+1 - Have the same issue.

tomrgio commented 7 years ago

+1 yes please!

JustLeo commented 7 years ago

+1

leofernandezg commented 7 years ago

+1 We need to attach more than a network interface to an intances. network_instances_ids must be a list.

KieranHons commented 7 years ago

+1

3rwww1 commented 7 years ago

Hi, same here, this issue prevents us from terraforming a critical part of our infrastructure.

I've noticed there are at least two already opened pull-requests for this: https://github.com/hashicorp/terraform/pull/10244 https://github.com/hashicorp/terraform/pull/10516

@sebcreme

chiradeep commented 7 years ago

@Andy--Rose for a workaround to the NetScaler issue, you could try using CloudFormation for just the NS VPX. Here is an example: https://github.com/chiradeep/netscaler-autoscale-lambda/tree/master/setup

lisfo4ka commented 7 years ago

+1

morkot commented 7 years ago

+1

PeterWeiler commented 7 years ago

+1

Use case is for name servers referenced in DHCP options. The ENIs are setup by another team's automation when the VPC is created. I need to find and use those ENIs when starting the instances that provide recursive name resolution.

grubernaut commented 7 years ago

Fixed via #12933

geoffles commented 7 years ago

Thanks for the fix :)

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.