You don't want to store secrets in state files. Imagine you run a CI/CD system where you run terraform plan. Now secrets is all public.
Re:Hashicorp Vault v1.0
by toomuchtodo on Tuesday December 04, 2018 @10:29PM
(#18605484)
https://github.com/hashicorp/terraform/issues/516
TLDR: Terraform should use Vault for storing secrets in state, but does not support it yet.
(it is occasionally unavoidable storing secrets in state due to resources orchestrated)
You can use the "random" provider to generate secrets, the "tls" provider to generate certs and I also wrote a "secret" provider[1] to hold arbitrary secrets.
The best part is that it doesn't require to maintain a long-running process. For small shops it's a good upgrade over storing credentials in code or using git-crypt.
[1]: https://github.com/tweag/terraform-provider-secret