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

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.

主站蜘蛛池模板: 滁州市| 华阴市| 上思县| 股票| 通城县| 朝阳市| 乌什县| 灵石县| 石狮市| 张掖市| 石嘴山市| 淮安市| 嵩明县| 靖西县| 全椒县| 修水县| 衡水市| 十堰市| 馆陶县| 增城市| 林口县| 炉霍县| 申扎县| 凤山市| 黑龙江省| 兴文县| 马山县| 绥宁县| 巴楚县| 丹巴县| 新民市| 朝阳县| 平度市| 鄂温| 开化县| 孟津县| 镇雄县| 永吉县| 临桂县| 高雄市| 新余市|