A plan on a 2,000-resource state takes 25 minutes. What do you look at?
AdvancedScenarioWorkflow and Providers
Answer
Situation read → Time goes to refreshing every resource via cloud APIs, often throttled.
What I'd do →
- Confirm with
TF_LOG=DEBUGor timing which provider calls dominate. - Short term:
terraform plan -refresh=falsefor quick local iteration, and raise-parallelismcarefully (default 10). - Medium term: split the state by lifecycle and ownership (network, data, apps).
- Check for API throttling and tune provider
max_retries.
Why → Plan time is roughly linear in state size, so the structural fix is smaller states, not flags.
Interview tip → -target is not a performance tool; it hides drift and leaves partial applies.
More on Workflow and Providers
A new teammate is about to run Terraform for the first time against a shared dev account. Which commands do you walk them through, and in what order?BeginnerYour manager asks why we bother with `terraform plan` when `apply` shows the same diff before asking for confirmation. What do you say?BeginnerTwo engineers get different provider versions and see different plans for the same code. How do you stop this?BeginnerSomeone committed the `.terraform/` directory to the repo. What should be in version control and what should not?BeginnerThe same configuration must create a VPC in `us-east-1` and a DR copy of a bucket in `eu-west-1`. How do you do it with one root module?IntermediateYou must deploy the same stack into 12 AWS accounts. How do you handle credentials and provider configuration?Intermediate