Sample Questions from Terraform Associate (TA-002) by HashiCorp

Preview a few questions below — answers are revealed when you take the exam.

  1. A team needs to deploy a multi-tier web application using Terraform. The application requires a load balancer, web servers, and a database. What approach should they take to ensure the infrastructure is scalable and maintainable?

    • Create a single Terraform configuration file that defines all resources and use terraform apply to deploy the entire stack in one go.
    • Split the infrastructure into multiple Terraform modules, each representing a different tier of the application, and use terraform apply on each module separately.
    • Use a combination of Terraform and CloudFormation to deploy the infrastructure, leveraging the strengths of both tools.
    • Manually configure the infrastructure using cloud provider consoles and then import the resources into Terraform using the terraform import command.
  2. Consider the situation where a Terraform configuration has drifted from its desired state due to manual changes made outside of Terraform. Which method solves it best?

    • Use the terraform refresh command to update the state file with the current infrastructure.
    • Manually edit the Terraform configuration files to match the current infrastructure and then run terraform apply.
    • Use the terraform import command to import the existing infrastructure into the Terraform state.
    • Delete the existing infrastructure and redeploy it using Terraform to ensure it matches the desired state.
  3. Identify the command used to initialize a Terraform working directory.

    • terraform init
    • terraform apply
    • terraform plan
    • terraform destroy
  4. Select the Terraform command that shows a preview of the actions Terraform will take to reach the desired state.

    • terraform plan
    • terraform apply
    • terraform init
    • terraform destroy
  5. Name the Terraform command that destroys all resources managed by the current configuration.

    • terraform destroy
    • terraform apply
    • terraform plan
    • terraform init