Prompt
Do I need a separate tool for secrets in infrastructure code?
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Usually, yes — if by “secrets” you mean things like API keys, database passwords, private keys, or tokens used by your infrastructure code.
Why a separate secrets tool is recommended
Infrastructure code tools like Terraform, CloudFormation, Pulumi, etc. are great for provisioning resources, but they are not ideal as the system of record for secrets because:
- State files can leak secrets if not handled carefully.
- Code repositories should not contain sensitive values.
- Access control and rotation are usually better handled by a dedicated secrets manager.
- Audit logging and lifecycle management are typically stronger in secret-management systems.
Common pattern
Use:
- Infrastructure code to create/configure the secret store and grant access
- A secrets manager to store and retrieve the actual secret values
Examples of secrets tools:
- HashiCorp Vault
- AWS Secrets Manager / SSM Parameter Store
- Azure Key Vault
- Google Secret Manager
- Kubernetes Secrets, often with an external secret manager backing them
When you might not need a separate tool
You may get by without one if:
- the “secret” is really just a non-sensitive config value,
- you’re in a very small/dev-only environment,
- or the value is injected entirely by your platform/CI/CD and never stored in code or state.
Rule of thumb
If the value must stay confidential and may need rotation, auditing, or restricted access, use a dedicated secrets manager rather than embedding it in infrastructure code.
If you want, I can also suggest the best pattern for your stack (Terraform, Kubernetes, AWS, Azure, etc.).