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

[bugfix] aws/eip: Don't save instance ID if association fails #1776

Merged
merged 1 commit into from
May 4, 2015

Conversation

radeksimko
Copy link
Member

This is allowing clean destroy in cases when no internet GW is available in VPC and corrupted state would normally appear.

How to replicate

resource "aws_vpc" "default" {
  cidr_block = "10.10.0.0/16"
}

resource "aws_subnet" "public" {
  vpc_id = "${aws_vpc.default.id}"
  cidr_block = "10.10.1.0/24"
  availability_zone = "us-east-1c"
}

resource "aws_instance" "web" {
  ami = "ami-323b195a"
  availability_zone = "us-east-1c"
  instance_type = "t2.small"
  key_name = "coreos-test"
  subnet_id = "${aws_subnet.public.id}"
  associate_public_ip_address = true
}

resource "aws_eip" "lb" {
  instance = "${aws_instance.web.id}"
  vpc = true
}

Output (that's still valid):

* Failure associating instances: Gateway.NotAttached: Network vpc-7c9abd19 is not attached to any internet gateway

destroy:

* MissingParameter: Either public IP or association id must be specified

The instance ID is saved to state file even though the API request ends up in error, which then results in trying to remove association which doesn't actually exist = corrupted state.

 - typically happens when no internet GW is available in VPC
@mitchellh
Copy link
Contributor

LGTM

mitchellh added a commit that referenced this pull request May 4, 2015
[bugfix] aws/eip: Don't save instance ID if association fails
@mitchellh mitchellh merged commit 9617761 into hashicorp:master May 4, 2015
@radeksimko radeksimko deleted the eip-without-igw branch May 4, 2015 18:46
@ghost
Copy link

ghost commented May 3, 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 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants