terraform apply executes the Terraform configuration in a project and creates or updates infrastructure in the cloud. Terraform generates an execution plan, shows the resources it will add, change, or destroy, and normally waits for an explicit yes before continuing. section 7.8.6 section 7.16
A practical apply workflow is:
- Initialize the Terraform project with terraform init before executing it. section 7.8.9
- Run terraform apply from the directory containing the Terraform files. section 7.8.6
- Review the proposed changes and enter yes to approve them. section 7.8.6
- Use terraform apply again after changing configuration; repeated applies support incremental infrastructure development. section 7.8.8
- Use -auto-approve for unattended execution, such as an automated deployment pipeline. section 7.9.2
Creating and rebuilding infrastructure
A first terraform apply creates an Azure resource group and reports a result such as “Apply complete! Resources: 1 added, 0 changed, 0 destroyed.” After adding a container registry, terraform apply -auto-approve applies the linked resources in dependency order. For practice or cleanup, terraform destroy removes the managed infrastructure, after which terraform apply recreates it. section 7.8.6 section 7.9.2 section 7.8.8
Terraform used the selected providers to generate the following
execution plan. Resource actions are indicated with the
following symbols:
+ create
Terraform will perform the following actions:
# azurerm_resource_group.flixtube will be created
+ resource "azurerm_resource_group" "flixtube" {
+ id = (known after apply)
+ location = "eastus"
+ name = "flixtube"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value:
Inspect a representative execution plan showing a resource addition, the approval prompt, and the planned resource count. section 7.8.6

