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

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.

主站蜘蛛池模板: 辽宁省| 清水县| 茌平县| 长兴县| 额济纳旗| 南皮县| 玉林市| 铜山县| 车险| 沅陵县| 北宁市| 东港市| 屏山县| 岫岩| 鄂托克前旗| 龙井市| 唐海县| 盖州市| 民乐县| 鹤壁市| 绥芬河市| 三穗县| 迭部县| 沙坪坝区| 日土县| 军事| 泸溪县| 乌鲁木齐县| 黄龙县| 南安市| 纳雍县| 肇州县| 达拉特旗| 长春市| 钦州市| 永城市| 昆山市| 呼玛县| 青海省| 东丰县| 侯马市|