Files
tldr/pages/common/terraform-init.md
T
Emmanuel Ferdman a704077d02 terraform-init, terraform-apply: add page (#21119)
Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2026-02-16 20:33:55 -06:00

960 B

terraform init

Initialize a new or existing Terraform working directory. More information: https://developer.hashicorp.com/terraform/cli/commands/init.

  • Initialize the current working directory:

terraform init

  • Initialize and upgrade modules and providers to the latest allowed versions:

terraform init -upgrade

  • Initialize and reconfigure the backend, ignoring any saved configuration:

terraform init -reconfigure

  • Initialize and reconfigure the backend, attempting to migrate any existing state:

terraform init -migrate-state

  • Initialize with additional backend configuration:

terraform init -backend-config '{{key}}={{value}}'

  • Initialize without backend or HCP Terraform initialization:

terraform init -backend=false

  • Initialize without interactive prompts (useful for automation):

terraform init -input=false

  • Initialize with the dependency lockfile mode set to readonly:

terraform init -lockfile readonly