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)- A4% (2)
- B2% (1)
- C93% (50)
- D2% (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.