官术网_书友最值得收藏!

  • Learning DevOps
  • Mikael Krief
  • 249字
  • 2021-06-24 12:32:07

Using destroy to better rebuild

One of the steps in the life cycle of an infrastructure that is maintained by IaC is the removal of the infrastructure because, let's not forget that one of the objectives and benefits of IaC, is to be able to make rapid changes to an infrastructure but also create environments on demand. That is to say, we create and keep environments as long as we need them, and we will destroy them when they are no longer used and hence allow the company to make financial savings.

To accomplish this, it is necessary to automate the removal of an infrastructure in order to be able to rebuild it quickly.

To destroy an infrastructure previously provisioned with Terraform, execute the following command:

terraform destroy

The execution of this command gives the following output:

This command, just as for apply, requires confirmation from the user before applying the destruction:

Once validated, wait for the confirmation message that the infrastructure has been destroyed.

The destroy command only destroys the resources configured in the current Terraform code. Other resources (created manually or by another Terraform code) are not affected. However, if our Terraform code provides a resource group, it will destroy all of its content.

For more information about the destroy command line, see the documentation:  https://www.terraform.io/docs/commands/destroy.html.

We have just seen that Terraform also allows us to destroy resources on the command line. Let's now look at how to format and validate your Terraform code.

主站蜘蛛池模板: 布尔津县| 仁怀市| 易门县| 岗巴县| 吉隆县| 神池县| 丰原市| 西安市| 漳浦县| 广西| 嘉鱼县| 大宁县| 新津县| 扬州市| 邯郸市| 武胜县| 屏边| 瓦房店市| 比如县| 中牟县| 札达县| 务川| 赞皇县| 政和县| 富源县| 利津县| 于田县| 邢台县| 关岭| 新民市| 涟水县| 柳江县| 泸西县| 永德县| 兴仁县| 武冈市| 禹州市| 赤水市| 公安县| 汕头市| 民丰县|