I have a scenario where I’m using AWS server setup with an EFS and RDS setup. To enable high availability, I’ve configured a PCS cluster, and as a result, some IP addresses have been reserved as virtual IPs.
For deployment, I’m using a Terraform script. However, I’ve noticed that sometimes during deployments, Terraform automatically assigns these reserved IPs to some resources.
To illustrate, in this setup, the app servers are in a private subnet, and the RDS is also in this private subnet. Sometimes, Terraform assigns one of the IPs, which are reserved for app servers as Virtual IPs, to the RDS.
I want to prevent Terraform from assigning these reserved IPs to any other resource during deployment. What are the best practices or solutions to achieve this in Terraform?