terraform init

The command that prepares a directory for Terraform: it downloads providers, fetches modules, connects the backend and writes the lock file.

In more detail

It never creates or changes infrastructure, so it is safe to run at any time and nearly instant on a prepared directory. Run it after cloning and whenever providers, version constraints, module calls or the backend change, including when you pull someone else's change to them. Other commands refuse to run and tell you to initialise when they detect it is needed.

Examples

terraform init
terraform init -input=false

Related terms

Taught in

References

Certification courses