mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-18 14:49:57 +00:00
42 lines
1009 B
Plaintext
42 lines
1009 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# terraform apply
|
|
|
|
> Create or update infrastructure according to Terraform configuration files.
|
|
> More information: <https://developer.hashicorp.com/terraform/cli/commands/apply>.
|
|
|
|
- Create or update infrastructure:
|
|
|
|
`terraform apply`
|
|
|
|
- Create or update infrastructure, skipping interactive approval:
|
|
|
|
`terraform apply -auto-approve`
|
|
|
|
- Apply a plan file:
|
|
|
|
`terraform apply {{path/to/file.tfplan}}`
|
|
|
|
- Specify values for input variables:
|
|
|
|
`terraform apply -var '{{name1}}={{value1}}' -var '{{name2}}={{value2}}'`
|
|
|
|
- Specify values for input variables from a file:
|
|
|
|
`terraform apply -var-file {{path/to/file.tfvars}}`
|
|
|
|
- Apply changes to a specific resource:
|
|
|
|
`terraform apply -target {{resource_type.resource_name[instance index]}}`
|
|
|
|
- Replace a specific resource:
|
|
|
|
`terraform apply -replace {{resource_type.resource_name[instance index]}}`
|
|
|
|
- Destroy Terraform-managed infrastructure:
|
|
|
|
`terraform apply -destroy`
|