How did you test your Terraform code?
AdvancedBehavioralInfrastructure as Code & Terraform state
Answer
Good answer looks like → "Static checks on every PR (validate, tflint, Checkov). Native terraform test with .tftest.hcl files for module logic using command = plan assertions, which are fast and free. For the VPC and EKS modules, a nightly job applied the module into a sandbox account, ran checks, and destroyed it."
Follow-ups to expect → How long did the integration tests take? How did you clean up after failed tests?
Red flags → "We test by applying to dev and seeing what happens" as the only strategy.
More on Infrastructure as Code & Terraform state
What did your Terraform state setup look like?IntermediateHow did you structure your Terraform code?BeginnerWhy did you use folders per environment rather than Terraform workspaces (or vice versa)?IntermediateHow did different Terraform stacks share information?IntermediateDid you ever have a state lock or corrupted state? What did you do?AdvancedHow did you handle Terraform drift?Intermediate