Untangling Terraform Through Refactoring
summary
Shows how to refactor Terraform configs safely by adding tests first and changing one piece at a time: use Test Kitchen with kitchen-terraform to provision AWS instances, write inspec tests (a ping test) that initially fail, make Terraform create the needed security rule, rerun kitchen verify until tests pass, then replace two security groups with one security group and finally extract the security group into a reusable module with an output consumed by the main config so the change works with minimal risk.
AI-written summary · about
