200-301 Question 500
Select 3A network administrator is tasked with automating the provisioning of cloud infrastructure for a new web application deployment. The administrator decides to use Terraform for this purpose. Which of the following steps are necessary to successfully deploy resources using Terraform?
- A
Write the infrastructure configuration in Terraform files using HashiCorp Configuration Language (HCL).
- B
Manually create the resources in the cloud provider console before running Terraform.
- C
Run 'terraform init' to initialize the working directory containing the Terraform configuration files.
- D
Use the 'terraform apply' command to create or modify cloud resources as defined in the configuration files.
- E
Directly edit the Terraform state file to make resource changes.
Show answer and explanation
Correct answers: A, C, D
Explanation
To use Terraform effectively, the administrator must write configuration files in HCL to define the desired infrastructure, initialize the environment using 'terraform init', and apply the configurations using 'terraform apply'. Manually creating resources or editing the state file directly is not aligned with Terraform's workflow and can lead to errors.
- A. Correct.
Correct. Terraform uses configuration files written in HCL to define the desired state of infrastructure. Writing these files is the foundational step in using Terraform.
- B. Incorrect.
Incorrect. Terraform is designed to automate the creation and management of resources. Manually creating resources would defeat its purpose and create inconsistencies.
- C. Correct.
Correct. 'terraform init' is a required command that initializes the working directory and downloads any necessary provider plugins.
- D. Correct.
Correct. 'terraform apply' is the command used to implement the changes defined in the configuration files.
- E. Incorrect.
Incorrect. Editing the Terraform state file directly is not recommended as it can lead to errors and inconsistencies in resource management.