resource aws_network_interface performs undesirable sort and attempts to detach primary ip address #14366
Labels
enhancement
Requests to existing resources that expand the functionality or scope.
service/ec2
Issues and PRs that pertain to the ec2 service.
Milestone
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Create initial eni:
Then add private_ips to the eni's
Expected Behavior
Terraform honours the ordering specified by the end user.
Actual Behavior
Terraform will order the private_ips lexicographically.
Steps to Reproduce
terraform apply
terraform plan
Important Factoids
Hello Hashicorp!,
The two unexpected behaviours that I am seeing:
The issue is that if at least one of the private_ips is lexicographically "less" than the private ip, terraform will attempt to set one of the secondary ips as the primary ip which will result in an error similar to this:
Therefore terraform should honour the order that is set by the end user.
Also, if the primary ip address (denoted in the attribute
private_ip
) must be the first element in the list, it may make sense to do this automatically if the private_ips has been passed, but the primary ip is not in the list.I.e. Concat the private_ip attribute and the private_ips attribute, placing the private_ip attribute as the first element.
References
The text was updated successfully, but these errors were encountered: