在这一步,你将执行销毁计划。现在你已经审查了计划并对变更感到放心,可以继续进行实际的销毁操作了。
terraform destroy 命令会首先展示相同的销毁计划以供最终审查,然后提示你确认后再继续。
在你的终端中运行以下命令:
terraform destroy
Terraform 将再次显示计划并请求你的批准。
local_file.example: Refreshing state... [id=ec3adcab998872def2df6200fb03992ac6f237a4]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
- destroy
Terraform will perform the following actions:
## local_file.example will be destroyed
- resource "local_file" "example" {
- content = "This is an example file managed by Terraform." -> null
- directory_permission = "0777" -> null
- file_permission = "0777" -> null
- filename = "./example.txt" -> null
- id = "ec3adcab998872def2df6200fb03992ac6f237a4" -> null
}
Plan: 0 to add, 0 to change, 1 to destroy.
Do you really want to destroy all resources?
Terraform will destroy all your managed infrastructure, as shown above.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value:
要确认销毁,输入 yes 并按 Enter 键。
yes
在你确认后,Terraform 将继续销毁资源并输出进度。
local_file.example: Destroying... [id=ec3adcab998872def2df6200fb03992ac6f237a4]
local_file.example: Destruction complete after 0s
Destroy complete! Resources: 1 destroyed.
这确认了 local_file 资源已被成功销毁。