Terraform Blue-Green Deploy example
Note: Use Terraform Modules as functions!!!
This will allow you to create a "networking" module, and use those outputs to populate the security groups, access zones, and subnet id's for your other modules.
Using autoscaling groups with a fixed size will protect you from AWs bugs or instance outages. This way an instance that dies, will be replaced so you always maintain the expected amount of instances for that service.
Workflow: