HashiCorp Certified: Terraform Associate — Question 98

You have some Terraform code and a variable definitions file named dev.auto.tfvars that you tested successfully in the dev environment. You want to deploy the same code in the staging environment with a separate variable definition file and a separate state file.

Which two actions should you perform? (Choose two.)

Answer options

Correct answer: B, C

Explanation

The correct actions are to create a new staging.auto.tfvars variable definition file and run Terraform with the var-file option (B), and to establish a new Terraform workspace for staging (C). Copying the state file (A) is not necessary as workspaces are designed to manage separate states. Creating a new Terraform provider (D) and adding new code (E) are not required for deploying to a different environment using the same codebase.