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

Error deleting Elastic IP association: InvalidAssociationID.NotFound #1682

Closed
bizmate opened this issue Sep 15, 2017 · 5 comments · Fixed by #3653
Closed

Error deleting Elastic IP association: InvalidAssociationID.NotFound #1682

bizmate opened this issue Sep 15, 2017 · 5 comments · Fixed by #3653
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@bizmate
Copy link

bizmate commented Sep 15, 2017

Terraform Version

$ terraform -v
Terraform v0.10.5

Affected Resource(s)

  • aws_eip_association

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

Full gist - https://gist.github.com/bizmate/9bdf7de4a00ef2339807ec1ba2cc075d
Short story

resource "aws_eip" "pivot_agent_public_ip" {
  #id                        = "eipalloc-57b6b864"
  vpc                       = true
  network_interface         = "${aws_network_interface.pivot_agent_network_interface.id}"
  associate_with_private_ip = "10.0.1.10"
  lifecycle {
    prevent_destroy = true
  }
}

resource "aws_eip_association" "eip_assoc" {
  instance_id   = "${aws_instance.pivot_gocd_agent.id}"
  allocation_id = "${aws_eip.pivot_agent_public_ip.id}"
}

resource "aws_instance" "pivot_gocd_agent" {
  ami           = "ami-1d4e7a66" # ubuntu 16.04 lts hvm:ebs-ssd
  instance_type = "t2.medium"

  tags {
    Name = "GoCD Agent for Pivot"
  }

  # The name of our SSH keypair we created above.
   key_name = "${aws_key_pair.auth.key_name}"

  # Our Security group to allow HTTP and SSH access
  vpc_security_group_ids = ["${aws_security_group.pivot_dev.id}"]

  # We're going to launch into the same subnet as our ELB. In a production
  # environment it's more common to have a separate private subnet for
  # backend instances.
  subnet_id = "${aws_subnet.subnet_pivot_dev.id}"

  #private_ip = "10.0.1.10"
  connection {
    # The default username for our AMI
    user = "ubuntu"
  }

  provisioner "remote-exec" {
    scripts = [
      "./bin/provision.sh"
    ]
  }

  provisioner "file" {
    source      = "config/gocd_agent.conf"
    destination = "/tmp/gocd_agent.conf"
  }

  provisioner "file" {
    source      = "config/autoregister.properties"
    destination = "/tmp/autoregister.properties"
  }

  # /var/lib/go-agent/config
  # /etc/default/go-agent

  provisioner "remote-exec" {
    scripts = [
      "./bin/start.sh"
    ]
  }

  lifecycle {
  	create_before_destroy = "true"
  }

}

Debug Output

https://gist.github.com/bizmate/9bdf7de4a00ef2339807ec1ba2cc075d
see destroy errors without finding association

Expected Behavior

Instance of ec2 and associated resources removed but IP

Actual Behavior

somehow it cannot find association that was created minutes before

Steps to Reproduce

  1. terraform apply I create the infrastructure
  2. terraform destroy -force -target=aws_instance.pivot_gocd_agent - I target the instance because i need to keep the IP reserved

Important Factoids

EC2 classic

References

unsure if linked to this hashicorp/terraform#6758

@Ninir Ninir added the bug Addresses a defect in current functionality. label Sep 18, 2017
@bizmate
Copy link
Author

bizmate commented Oct 26, 2017

BTW i could not see this bug anymore. i m now using 010.7 and i have no clue if the provider version was updated and maybe fixed this

@bflad
Copy link
Contributor

bflad commented Mar 7, 2018

Bugfix PR submitted: #3653

@bflad bflad added this to the v1.11.0 milestone Mar 8, 2018
@bflad
Copy link
Contributor

bflad commented Mar 8, 2018

The fix for this has been merged into master and will be released in v1.11.0 of the AWS provider, likely tomorrow. 👍

@bflad
Copy link
Contributor

bflad commented Mar 9, 2018

This has been released in version 1.11.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
4 participants