In the AWS Console (EC2 > Network Interfaces > eni-xxxxxx), in the Actions menu, you find the Manage IP address option, and you can Assign new IP address for the interface, including the Auto-assign possibility.
So my suggestion is to add an argument network_interface_id to specify the network interface id that you want to modify, example:
resource “aws_network_interface” “principal” {
network_interface_id = module.ec2_create.primary_network_interface_id
subnet_id = module.ec2_create.subnet_id // May be required only if network_interface_id is not specified
private_ips_count = 2
}
So, you can have a secondary IP address added to this interface.
Thank you.