-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a hash to random_password #73
Conversation
5853793
to
dd18581
Compare
some feedback would be highly appreciated, thanks. |
Noticed that with the cost as a a variable, all resources would get recreated and thus may break existing things. |
Just what I've been looking for for a while now and seems to be working as intended. Please go for it, this increases bcrypt()'s usefulness by orders of magnitude. |
a87203d
to
db3a41d
Compare
Using the `bcrypt` function from terraform can be annoying to use in cases where you cannnot ignore changes with `lifecycle` (like data resources or interpolation). In these cases, a password can be generated with the random_password resource and the hash can be used directly from the newly added attribute.
signed the CLA, rebased and cleaned up the commit. |
Looking for this myself! |
i would really like this option as well. |
we are also eagerly waiting on this fix. any idea when it will be merged ? |
Also very eager to be able to use this! |
I posted a workaround in this related GH issue for anyone struggling with this |
will this ever come? 😭 |
Hi @tommyknows, thank you for submitting this PR and apologies that it has taken a while for us to get to this. The proposed changes look good. There have been some significant changes to random provider since your original submission. In order to incorporate your changes, could you either rebase or let us know that you'd like us to move forward with your proposal? |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Hi,
Problem
We have experienced cases where we need to hash a password with
bcrypt
. Thebcrypt
function in terraform always generates a new hash on every run (which is according to spec). However, this can be annoying to use.For example:
In this example,
vault_generic_secret.password
gets changed on every run. There is also no way (at least no obvious one) to work around this problem -ignore_changes
cannot be used when this kind of interpolation is required.Solution
The solution to this is to add a
bcrypt_hash
field to therandom_password
resource. This always returns the same hash (as it is stored in the terraform state), unless the password (random string) itself is changed.With that, the above usecase can be done just by doing