深入理解 Terraform:资源清理与状态管理
1. 资源清理
当完成 Terraform 实验后,为避免 AWS 产生不必要的费用,需移除创建的所有资源。由于 Terraform 会跟踪所创建的资源,清理操作十分简单,只需运行 destroy 命令:
$ terraform destroy
执行该命令后,Terraform 会列出即将销毁的资源,例如:
Terraform will perform the following actions:
# aws_autoscaling_group.example will be destroyed
- resource "aws_autoscaling_group" "example" {
(...)
}
# aws_launch_configuration.example will be destroyed
- resource "aws_launch_configuration" "example" {
(...)
}
# aws_lb.example will be destroyed
- resource "aws_lb" "example" {
(...)
}
(...)
Plan: 0 to add, 0 to change, 8 to destroy.
Do you really want to destroy all resources?
订阅专栏 解锁全文
78



被折叠的 条评论
为什么被折叠?



