TA-002-P · Question #289
What is the best and easiest way for Terraform to read and write secrets from HashiCorp Vault?
The correct answer is A. Vault provider. The Vault provider is the native Terraform integration for reading and writing secrets from HashiCorp Vault, requiring minimal configuration compared to any alternative approach.
Question
What is the best and easiest way for Terraform to read and write secrets from HashiCorp Vault?
Options
- AVault provider
- BAPI access using the AppRole auth method
- Cintegration with a tool like Jenkins
- DCLI access from the same machine running Terraform
How the community answered
(59 responses)- A88% (52)
- B3% (2)
- C2% (1)
- D7% (4)
Why each option
The Vault provider is the native Terraform integration for reading and writing secrets from HashiCorp Vault, requiring minimal configuration compared to any alternative approach.
The Vault provider is a purpose-built Terraform provider that reads and writes secrets directly within HCL configuration by exposing Vault paths as data sources and resources. It handles authentication using supported Vault auth methods natively, making it the simplest and most idiomatic approach without requiring external tooling or manual scripting.
Using raw API calls with the AppRole auth method requires custom scripting outside Terraform's native workflow and is far more complex than using the provider.
Integrating a tool like Jenkins adds unnecessary infrastructure dependency just to access secrets and is not a Terraform-native solution.
CLI access from the same machine is a manual, non-reproducible approach that does not integrate cleanly with Terraform's declarative and automated model.
Concept tested: Terraform HashiCorp Vault provider for secrets management
Source: https://registry.terraform.io/providers/hashicorp/vault/latest/docs
Topics
Community Discussion
No community discussion yet for this question.