You are making changes to existing Terraform code to add some new infrastructure. When is the best time to run terraform validate?
- AAfter you run terraform plan so you can validate that your state file is consistent with your infrastructure
- BBefore you run terraform plan so you can validate your code syntax (correct answer)
- CBefore you run terraform apply so you can validate your infrastructure changes
- DAfter you run terraform apply so you can validate that your infrastructure is reflected in your code
Reveal answer & explanationHide answer
The correct answer is B. Option B: Before you run terraform plan so you can validate your code syntax
Explanation
terraform plan compares configuration and state with real infrastructure and previews the proposed changes without applying them.