init
What is init?
init: Initialises a working directory — downloads providers and modules, configures the backend. Run it first, and after changing providers. terraform init prepares a working folder. It downloads the providers and modules your configuration uses, and connects to the backend where state is stored. You run it once when you start working on a project, and again after adding a provider, changing a module version or changing the backend. terraform init -upgrade updates providers to the newest versions your constraints allow.
Frequently asked questions about init
What should you keep in mind with init?
Init writes a .terraform.lock.hcl file that records exact provider versions. Commit that file, so everyone on the team and in CI uses the same versions. The .terraform folder with downloaded plugins should not be committed. If plans behave differently on two machines, comparing provider versions in the lock file is a good first check.
What does an example of init look like?
terraform init -upgrade At a glance
| Category | Terraform |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |