nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #241

When you use a backend that requires authentication, it is best practice to:

The correct answer is C. Use environment variables to configure authentication credentials outside of your Terraform. Best practice is to avoid hardcoding sensitive credentials in Terraform configurations or storing them in version control. Instead, credentials should be managed via environment variables, CLI authentication helpers, or secret managers (e.g., Vault).

Submitted by minji_kr· Apr 18, 2026Manage Terraform State

Question

When you use a backend that requires authentication, it is best practice to:

Options

  • ARun all of your Terraform commands on a shared server or container.
  • BConfigure the authentication credentials in your Terraform configuration files, and store them in a
  • CUse environment variables to configure authentication credentials outside of your Terraform
  • DNone of the above.

How the community answered

(54 responses)
  • A
    4% (2)
  • B
    2% (1)
  • C
    93% (50)
  • D
    2% (1)

Explanation

Best practice is to avoid hardcoding sensitive credentials in Terraform configurations or storing them in version control. Instead, credentials should be managed via environment variables, CLI authentication helpers, or secret managers (e.g., Vault).

Topics

#Authentication#Backend configuration#Security best practices#Environment variables

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice