Linux command
terraform-plan 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create execution plan
terraform plan
Save plan to file
terraform plan -out=[plan.tfplan]
Plan with variable
terraform plan -var="[key]=[value]"
Plan destroy
terraform plan -destroy
Plan specific target
terraform plan -target=[resource]
说明
terraform plan creates an execution plan showing proposed changes. Compares current state with configuration. Review before applying to understand infrastructure changes.
参数
- -out _file_
- Save plan to file.
- -var _name=value_
- Set variable.
- -var-file _file_
- Variable file.
- -target _resource_
- Target specific resource.
- -destroy
- Plan destruction.
- -refresh-only
- Only refresh state.
- -detailed-exitcode
- Exit 2 if changes planned.
FAQ
What is the terraform-plan command used for?
terraform plan creates an execution plan showing proposed changes. Compares current state with configuration. Review before applying to understand infrastructure changes.
How do I run a basic terraform-plan example?
Run `terraform plan` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -out _file_ do in terraform-plan?
Save plan to file.