The terraform apply command is the primary mechanism for making infrastructure changes in the core Terraform workflow. It executes the operations proposed in a Terraform plan, interacting with infrastructure provider APIs to create, update, or destroy real-world resources so they match the desired state described in your configuration. After apply completes, Terraform updates the state file to reflect the new actual state of all managed resources. There are two modes in which terraform apply can run. In automatic plan mode, running terraform apply without a saved plan file causes Terraform to automatically generate a fresh execution plan, display it to the user, and prompt for confirmation before proceeding. In saved plan mode, passing a plan file produced by terraform plan causes Terraform to execute that exact set of changes without prompting for confirmation, because passing the file is treated as implicit approval. The -auto-approve flag skips the interactive confirmation prompt in automatic plan mode, which is commonly used in CI/CD pipelines and automation contexts. HashiCorp warns that using -auto-approve increases the risk of unpredictable changes and configuration drift if infrastructure can be modified outside of the Terraform workflow. When a saved plan file is provided, -auto-approve has no effect since approval is already implied. Additional apply options allow practitioners to customize behavior: -replace targets a specific resource instance for forced replacement, -var and -var-file supply input variable values at runtime, -parallelism controls concurrent provider API calls (defaulting to 10), and -lock=false disables state locking (which is dangerous in shared environments). Planning modes like -destroy and -refresh-only are also available when running without a saved plan file.
terraform apply executes the operations proposed in a Terraform plan by calling the relevant infrastructure provider APIs to create, update, or destroy resources.
After a successful apply, Terraform updates the state file to record the new actual state of all managed infrastructure resources.
In automatic plan mode (no plan file passed), Terraform generates a fresh plan and prompts the user for confirmation before making any changes.
In saved plan mode, passing a plan file produced by terraform plan causes apply to execute that exact set of changes without prompting, since passing the file is treated as approval.
The -auto-approve flag skips the interactive confirmation prompt in automatic plan mode and is ignored when a saved plan file is passed.
Planning modes and planning options such as -replace, -var, and -var-file are only available when running terraform apply without a saved plan file.