Skip to content

Instantly share code, notes, and snippets.

@mclavel
Created May 24, 2018 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mclavel/0d6f54481afbdd14fbf38d11b3a8a2d8 to your computer and use it in GitHub Desktop.
Save mclavel/0d6f54481afbdd14fbf38d11b3a8a2d8 to your computer and use it in GitHub Desktop.
resource "random_string" "password" {
 length = 16
 special = true
}
resource "mysql_user" "root" {
 user = "root"
 host = "example.com"
 plaintext_password = "${sha256(bcrypt(random_string.password.result))}"
lifecycle {
ignore_changes = ["plaintext_password"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment