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

Sort private ips for an AWS instance in Terraform #15173

Closed
Joe6547654 opened this issue Jun 7, 2017 · 1 comment
Closed

Sort private ips for an AWS instance in Terraform #15173

Joe6547654 opened this issue Jun 7, 2017 · 1 comment

Comments

@Joe6547654
Copy link

Joe6547654 commented Jun 7, 2017

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)

  • aws_instance
  • aws_network_interface

Terraform Configuration Files

resource "aws_network_interface" "test" {
	subnet_id = "subnet-xxxxxxx"
	private_ips = ["172.24.3.249", "172.24.3.250", "172.24.3.5", "172.24.3.9", "172.24.3.13"]
}
resource "aws_instance" "test" {
	ami = "ami-xxxxxxxx" 	
	instance_type = "m4.2xlarge"
	key_name = "name"
	network_interface {
	network_interface_id = "${aws_network_interface.test.id}"
	device_index = 0
	}
}

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:

@ghost
Copy link

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

No branches or pull requests

3 participants