How do you manage VPCs and network resources with Terraform without drift or accidents?
IntermediateScenarioNetwork Operations & Change Management
Answer
Situation read → Shared network code has a large blast radius.
What I'd do →
- Keep network in its own state, with remote backend and locking (S3 plus DynamoDB or native S3 locking)
- Use a reviewed module for VPC, subnets and routes with
cidrsubnet - Add
prevent_destroyon VPCs and TGWs - Run
terraform planon a schedule to detect drift - Restrict who can apply via CI roles
Why → A small, isolated state limits what one bad apply can destroy.
Interview tip → Say you separate network from application stacks for blast radius reasons.
More on Network Operations & Change Management
How do you roll out a security group or firewall change in production safely?IntermediateA route table was changed by mistake and production lost internet access. How do you recover and learn?IntermediateData transfer charges are 30% of the AWS bill. How do you reduce them?IntermediateWhat is your checklist for onboarding a new office to your cloud network over VPN?IntermediateDesign network disaster recovery for the loss of an entire region.Advanced