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

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.

主站蜘蛛池模板: 常熟市| 阿巴嘎旗| 加查县| 霞浦县| 抚顺市| 甘南县| 建平县| 平乡县| 无极县| 铜川市| 阿拉善右旗| 益阳市| 天长市| 曲阳县| 内江市| 峨眉山市| 铜鼓县| 汽车| 贞丰县| 旌德县| 新和县| 永嘉县| 紫阳县| 宜州市| 屏边| 满洲里市| 璧山县| 吕梁市| 青川县| 新闻| 霍山县| 汨罗市| 资阳市| 亚东县| 阜康市| 五大连池市| 黄冈市| 洪湖市| 沂水县| 梅河口市| 开阳县|