terraform apply
The command that carries out a plan, creating, changing and deleting real infrastructure, then records the result in state.
In more detail
Run on its own, it plans again and waits for you to type yes. Given a saved plan file, it applies exactly that plan with no question, or refuses if state has changed since. Even a correct plan can fail halfway, for example on a quota or a permission, so read the apply report as well as the plan.
Example
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.Related terms
- terraform plan — The command that compares configuration, state and reality and prints the actions needed to make them match, without changing anything.
- Terraform state — Terraform's record, usually a JSON file called terraform.tfstate, mapping each resource in the configuration to the real object it created.
- Terraform — An infrastructure-as-code tool from HashiCorp that creates and changes cloud resources such as servers, networks and databases from configuration files.
- saved plan — A plan written to a file with -out, which terraform apply can later carry out exactly as reviewed.
- -auto-approve — The option that makes apply or destroy skip the yes prompt and act immediately.
Taught in
- Infrastructure as Code (Handover to Terraform) — Cloud Infrastructure & Hyperscaler Architecture
- What Is Infrastructure As Code? — Infrastructure as Code with Terraform
- Installing Terraform And Meeting The CLI — Infrastructure as Code with Terraform
- Predicting Changes, Then Applying Them — Infrastructure as Code with Terraform
- Tearing It Down With Destroy — Infrastructure as Code with Terraform
- Return Values: Outputs And Locals — Infrastructure as Code with Terraform
- Running Terraform In CI — Infrastructure as Code with Terraform
- The Plan That Wanted To Destroy Production — HashiCorp Terraform Associate (004) Exam Prep
- Infrastructure As Code, And One Workflow For Every Platform — HashiCorp Terraform Associate (004) Exam Prep
- Providers: How Terraform Reaches Every API — HashiCorp Terraform Associate (004) Exam Prep
- Versions, The Lock File And Provider Aliases — HashiCorp Terraform Associate (004) Exam Prep
- State: Terraform's Memory Of What It Built — HashiCorp Terraform Associate (004) Exam Prep
- Write, Plan, Apply, And What Init Prepares — HashiCorp Terraform Associate (004) Exam Prep
- Reading A Plan, Saving It, Applying It — HashiCorp Terraform Associate (004) Exam Prep
- Validate, Format, Destroy, And The Flags That Bend A Plan — HashiCorp Terraform Associate (004) Exam Prep