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

  • 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.

主站蜘蛛池模板: SHOW| 无极县| 霍邱县| 荣昌县| 习水县| 常宁市| 库伦旗| 广汉市| 万州区| 施甸县| 贺兰县| 凉城县| 江安县| 龙州县| 延庆县| 壤塘县| 望谟县| 双牌县| 抚顺市| 天峻县| 合川市| 新巴尔虎右旗| 方正县| 化州市| 长武县| 蛟河市| 亚东县| 通榆县| 南和县| 黑山县| 仙游县| 高陵县| 洮南市| 江阴市| 隆德县| 聂拉木县| 大安市| 金山区| 威信县| 简阳市| 印江|