Terraform-provider-aws: terraform re-apply does not associate ip address if instance deleted from aws UI.

Created on 7 Sep 2017  ยท  6Comments  ยท  Source: hashicorp/terraform-provider-aws

_This issue was originally opened by @dattatrayakumbhar as hashicorp/terraform#15980. It was migrated here as a result of the provider split. The original body of the issue is below._


Terraform Version

Terraform v0.10.3
[Same code with terraform 0.9.1, works fine]

Terraform Configuration Files

resource "aws_instance" "edge_i" {
instance_type = "t2.small"
ami = "ami-5a969821"
key_name = "dateast1"
subnet_id = "subnet-363c631a"
vpc_security_group_ids = ["sg-b9e9bec9"]
}

resource "aws_eip" "edge_eip" {
vpc = "true"
instance = "${aws_instance.edge_i.id}"
}
resource "aws_instance" "asa_i" {
instance_type = "c3.large"
ami = "ami-b5e0ada2"
key_name = "dateast1"
vpc_security_group_ids = ["sg-b9e9bec9"]
subnet_id = "subnet-363c631a"
}
resource "aws_eip" "asa_eip" {
vpc = "true"
instance = "${aws_instance.asa_i.id}"
}

Debug Output

trace.txt

Expected Behavior

instance should come up and public IP should get associated.

Actual Behavior

instance came up but public IP failed to associate with below error:

  • aws_eip.edgedatta: 1 error(s) occurred:

  • aws_eip.edgedatta: MissingParameter: Either public IP or association id must be specified
    status code: 400, request id: bd049797-2f2d-4874-b819-ae0abd96f38b

  • aws_eip.asadatta: 1 error(s) occurred:

  • aws_eip.asadatta: MissingParameter: Either public IP or association id must be specified
    status code: 400, request id: 4dd49ef0-4108-4127-85c8-8d3643a95614

Steps to Reproduce

Steps:

  1. Terraform apply
  2. Delete instance only from aws UI.
  3. terraform apply again.
bug

Most helpful comment

Any news on this? We're experiencing the same issue- version 0.10.7

All 6 comments

I can confirm this behaviour. I had to manually delete some things due to a dependency issue when recreating a complete VPC. After having manually deleted an instance with an EIP attached, this happened.

Can downgrading the provisioner version get us out of this problem? Any workarounds? Thanks.

The workaround is to go and manually assign EIP to your instance. After that plan shows no required changes for EIP resource

@boldandbusted: I compiled the provider manually with darkowlzz's fix; stuck it into a plugins folder and referenced the full-path in my ~/.terraformrc (I believe there's a bug in TF that it does not search PATH for plugins).
Compile process was very straight forward too (I left my overkill-notes in the PR thread)

Any news on this? We're experiencing the same issue- version 0.10.7

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!

Was this page helpful?
0 / 5 - 0 ratings