Typical Terraform workflow
The following steps are executed in a typical Terraform workflow:
terraform init(to initialize the working directory)- Initializes the backend
(optional, where state is stored (local, remote, …) and how it is accessed (credentials, …)) - Downloads and installs provider plugins
- Downloads submodules (optional)
- Initializes the backend
terraform plan(included interraform applyor separated with.planfile)- Locks current state
- Downloads current state into memory
- Refreshes state in memory
- Plans and outputs changes
terraform apply- Applies changes, if any
- Updates state, if necessary
- Unlocks current state
terraform output(also included interraform apply)- Shows output of root module
