-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Bug with aws_eip while using count #4944
Comments
We might have a different problem, but we are also seeing a race condition related to multiple EIP's and a nat_gateway. Without posting the whole file, the thing we are seeing is: -Create a mini VPC with 4 public/private subnets Bug: the 4 NAT's are all given the same EIP If needed, I could add the statefile. For now, seems like there's an issue related to EIP+Count. Will wait to see if the above is confirmed as a bug. |
@ElliotG Can you provide a cut down example? |
This is how I'm configuring multiple EIPs, seems to work.
|
For whatever reason, we saw this behavior (on Terraform 6.8 or 6.9, i can't remember, we have since upgraded). We were able to trivially fix it with this:
|
I'm seeing this today when I tried to create a couple new instances using
I did find it interesting that TF wanted to make changes to the EIP on the existing instance despite there being no actual change to the code other than the count variable:
I think it may be related to starting off where count = 1 being entered into state like so:
And so there isn't a aws_instance-compute.0 while count = 1. Managing instances by manipulating the count via CLI has worked brilliantly up to this point. |
This just happened to me. Here's the relevant code:
Path to error:
The exact error:
Worth noting that
|
@ArnaudBrousseau I concur that so far a second apply does bring state into consistency and all is well. I didn't actually check the console to verify that the process was successful, but historically the AWS functions do complete while TF itself trips over it's state management. |
Try adding
to the aws_eip definition. Seem to work OK so far. |
Just for the record, I have
inside each aws_eip def and I still need to apply twice. |
@Gary-Armstrong I think you might want try remove
|
Hello! This should be fixed in later versions of Terraform (0.7.11 at time of writing). Its hard to know 100% for a couple reasons:
Please try again! If the issue persists please just open a new issue. Thanks! |
Hi, I still have the issue when incrementing the count of instance existing eip associations are re-created. Here is the plan log : -/+ aws_eip_association.io-mvstud-eip-assoc-apps-production.1
allocation_id: "eipalloc-fbc22b9c" => "eipalloc-fbc22b9c"
instance_id: "i-06386f27f8c161946" => "${element(aws_instance.io-mvstud-ec2-apps-production.*.id, count.index)}" (forces new resource)
network_interface_id: "eni-c310f483" => "<computed>" I basically have a pool of eip that I associate with ec2 instances.
I don't understand why terraform can't keep the existing association when incrementing the |
I am also seeing an issue where Elastic IP address are being recreated when using count when I run has any one found a solution for this yet? vpc = true
count = "${var.webserver_count}"
instance = "${element(aws_instance.webserver.*.id, count.index)}"
depends_on = ["aws_instance.webserver"]
} |
When using a similar pattern, I also encounter an issue where Terraform assumes the EIP resource should be modified instead of correctly interpolating the instance ID.
|
I'm seeing this with NAT Gateways too when using an interpolated
|
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. |
Hi,
Below is my terraform file.
After increasing the count from 1 to 2 (Basically anytime I change the count ) , I hit the below error. Running terraform apply second time works but this seems to be a bug:
The text was updated successfully, but these errors were encountered: