Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS network_interface detaches instances #2881

Closed
stack72 opened this issue Jul 29, 2015 · 1 comment · Fixed by #2943
Closed

AWS network_interface detaches instances #2881

stack72 opened this issue Jul 29, 2015 · 1 comment · Fixed by #2943

Comments

@stack72
Copy link
Contributor

stack72 commented Jul 29, 2015

I am creating a solution for NAT in AWS that when a new member of a NAT autoscale group is created, it will attach itself to the network interface.

the code effectively works as follows:

/usr/local/bin/aws ec2 attach-network-interface --network-interface-id $ENI_ID --instance-id $INSTANCE_ID --device-index 1 --region $ZONE

The network interface is terraform managed:

resource "aws_eip" "nat_ip" {
  vpc = true
  network_interface = "${aws_network_interface.nat_eni.id}"
}

resource "aws_network_interface" "nat_eni" {
  subnet_id = "${aws_subnet.primary-public.id}"
  security_groups = ["${aws_security_group.nat.id}"]
  source_dest_check = false

  tags {
    Name = "NAT ENI"
  }
}

On subsequent Terraform runs the attached instance is removed from the network interface and EIP as it was not part of the initial creation

~ aws_network_interface.nat_eni
    attachment.#:                       "1" => "0"
    attachment.2655983607.device_index: "1" => "0"
    attachment.2655983607.instance:     "i-30003f9d" => ""

~ aws_eip.nat_ip
    instance: "i-b3efd01e" => ""

This feels like a sledgehammer approach - is this intended?

phinze added a commit that referenced this issue Aug 5, 2015
If Terraform creates and ENI and it's attached out of band, Terraform
should not attempt to remove the attachment on subsequent runs.

fixes #2436
fixes #2881
phinze added a commit that referenced this issue Aug 5, 2015
If Terraform creates an ENI and it's attached out of band, Terraform
should not attempt to remove the attachment on subsequent runs.

fixes #2436
fixes #2881
@ghost
Copy link

ghost commented May 1, 2020

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.

@ghost ghost locked and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants