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

Applying the changes

After having validated that the result of the plan command corresponds to our expectations, the last step is the application of the Terraform code in real time to provision and apply the changes to our infrastructure.

For this, we execute the apply command:

terraform apply

This command does the same operation as the plan command and interactively asks the user for confirmation that we want to implement the changes.

The following is a screenshot of the terraform apply confirmation:

The confirmation is given by inputting yes (or no to cancel), then Terraform applies the changes to the infrastructure.

The following is a screenshot of the terraform apply execution:

The output of the apply command displays all actions executed by Terraform, with all changes and the impacted resources. It ends with a summary line that displays the sum of all added, changed, or destroyed resources.

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

Since the Terraform apply command has been executed correctly, we can check in the Azure portal that the resources described in the Terraform code are present.

The following is a screenshot of Azure resources by Terraform:

We can see from the portal that the resources specified in the Terraform code have been provisioned successfully.

We have just seen how Terraform is useful for provisioning infrastructure with three main commands:

  • The init command that initializes the context
  • The plan command to preview the changes
  • The apply command to apply the changes

In the next section, we will explore other Terraform commands and the Terraform's life cycle.

主站蜘蛛池模板: 客服| 班戈县| 鸡泽县| 东丰县| 固始县| 连州市| 武强县| 连江县| 偃师市| 石首市| 定安县| 威远县| 增城市| 东乡县| 始兴县| 荣成市| 武平县| 葫芦岛市| 阜新市| 宜兰市| 浦北县| 杭州市| 北票市| 谢通门县| 昌都县| 勃利县| 三门县| 连江县| 汉沽区| 东阿县| 拜泉县| 萨迦县| 铁岭市| 彝良县| 肇源县| 昭平县| 大厂| 莆田市| 盐亭县| 盘山县| 鄢陵县|