Company
Date Published
June 9, 2022
Author
Jack Roper
Word count
603
Language
English
Hacker News points
None

Summary

The `terraform apply` command is used to deploy infrastructure as described in configuration files. It executes the actions proposed in a `terraform plan`. Typically, `apply` should be run after `terraform init` and `terraform plan`. If run without options, it generates a plan, asks for confirmation, and then applies changes. The command can also use a previously generated planfile or pass in variable values. It is safe to run multiple times if there are no changes in the configuration files. In automation, `terraform apply` can be used with the plan output file or with the `-auto-approve` option for CI/CD pipelines. Spacelift offers a more robust way of automating infrastructure provisioning lifecycle and managing Terraform state.