このステップでは、破棄計画を実行します。計画を確認し、変更内容に確信が持てたので、実際の破棄に進むことができます。
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 リソースが正常に破棄されたことが確認できました。