What does `terraform init` do?
BeginnerConceptWorkflow and CLI
Answer
It prepares a working directory: configures the backend, downloads required providers and modules, and writes .terraform.lock.hcl. It is safe to re-run. Run it after adding a provider, changing module sources or switching backends.
terraform init
terraform init -upgrade # re-resolve provider and module versions
More on Workflow and CLI
What does `terraform plan` do?BeginnerWhat does `terraform apply` do and what is `-auto-approve`?BeginnerWhat does `terraform destroy` do?BeginnerWhat do `terraform fmt` and `terraform validate` check?BeginnerWhy save a plan with `-out` and apply that file?IntermediateWhat does `-detailed-exitcode` do?Intermediate