There are many Git issues opened on the Terraform repo about this issue, with lots of interesting comments, but as of now I still see no solution to this issue.
Terraform stores plain text values, including passwords, in tfstate files.
Most users are required to store them remotely so the team can work concurrently on the same infrastructure with most of them storing the state files in S3.
So how do you hide your passwords?
Is there anyone here using Terraform for production? Do you keep you passwords in plain text?
Do you have a special workflow to remove or hide them? What happens when you run a terraform apply
then?
I've considered the following options:
- store them in Consul - I don't use Consul
- remove them from the state file - this requires another process to be executed each time and I don't know how Terraform will handle the resource with an empty/unreadable/not working password
- store a default password that is then changed (so Terraform will have a not working password in the tfstate file) - same as above
- use the Vault resource - sounds it's not a complete workflow yet
- store them in Git with git-repo-crypt - Git is not an option either
- globally encrypt the S3 bucket - this will not prevent people from seeing plain text passwords if they have access to AWS as a "manager" level but it seems to be the best option so far
From my point of view, this is what I would like to see:
- state file does not include passwords
- state file is encrypted
- passwords in the state file are "pointers" to other resources, like "vault:backend-type:/path/to/password"
- each Terraform run would gather the needed passwords from the specified provider
This is just a wish.
But to get back to the question - how do you use Terraform in production?