-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Sort private ips for an AWS instance in Terraform #836
Comments
#1749 fixes this behavior but hasn't received any attention since more than a year. |
How is such a fundamental use case still an issue? This problem has cost us thousands as we have to use larger instance types that support more nics/ips as we can only assign a single ips on the primary nic when it needs to be known. We expected it would only be temporary but have now been doing it for over a year. It is frustrating. |
With terraform you can already have multiple IPs on the primary nic, just build your instance via port as shown in the bug description. To avoid this bug, start with one ip, then build the instance, then add other IPs. Be aware that the number of ips is restricted by AWS, that is not a |
That’s fine if you are manually creating your instances but if you have built an automated pipeline and give developers ability to spin up their own evironements then things aren’t so simple. I am very much aware that nic/ip limit is from AWS and not Terraform. To clarify; as I require a known primary ip for the load balancer I am spinning up I cannot add my additional ips to the primary nic therefore I have to use a larger instance type than desired to get my required number of ips. |
It might be possible to do something hacky like use the output from an initial template that creates the original interface to import into another module and reference that existing interface with a larger set of IPs (the primary plus secondaries), but I haven't attempted that yet and you'd need to figure out whether to append it to the list/set or if you would need to redefine the primary as well as the secondaries so it wouldn't drop the initial/primary IP. This may also lead to "flapping" if re-running the initial module removes the extra IPs each time. |
This functionality has been released in v3.74.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
This issue was originally opened by @Joe6547654 as hashicorp/terraform#15173. It was migrated here as part of the provider split. The original body of the issue is below.
Hi, I am using terraform to create an instance with multiple ips in AWS. I specified a list of private_ips in the network interface block and I made sure the one I wanted as primary ip was listed first on the list, however it does not respect that order when I create the instance in AWS. Order doesn't change even when when I change the ips around. I also tried setting with private_ip for the primary ip and private_ips for secondary ips, but it doesn't work.
Terraform Version: 0.9.6
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
The first ip address on the list will appear as the primary ip, and the rest as the secondary ips.
Actual Behavior
"172.24.3.5" becomes the primary instead of the first ip on the list. It does not change even if we switch the order of the ips.
References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
The text was updated successfully, but these errors were encountered: