-
Notifications
You must be signed in to change notification settings - Fork 973
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
Increase the default complexity of Cloud SQL DB passwords #2886
Increase the default complexity of Cloud SQL DB passwords #2886
Conversation
…word_validation_policy.default_complexity
Added code to explicitly generate a root_password also (using the same logic). Otherwise the DB fails to create because the default (Google generated) password doesn't match the password policy. As mentioned in hashicorp/terraform-provider-google#17265 |
Maybe the module shouldn't do this? And rely on the caller passing a valid root_password, rather than generating it here? (but that's inconsistent with the pattern for non-root users, which do generate passwords if not provided) |
Changed the DB with no root_password configInput:
Output: Fails to create: DB with explicit password (too short)Input:
Output: Fails to create: DB with explicit password (OK)Input:
Output:
DB with random_passwordInput:
Output: $ terraform state show -show-sensitive module.db-random.google_sql_database_instance.primary | grep root
root_password = "K*7bTarLtA-1!W=KK@$c" DB with both explicit password and random_password (override)Input:
Output: $ terraform state show -show-sensitive module.db-override.google_sql_database_instance.primary | grep root
root_password = "FZ1F4aQ3&qVKM5B<tUrx" |
This is great, thanks for taking the time to run the changes. Can I ask you one last effort
|
…g both a password and `random_password`. Fix test for stronger password generation.
I tested with no password_policy: module "db-none" {
source = "../modules/cloudsql-instance"
name = "test-db-no-root-password"
}
module "db-no-policy-password" {
source = "../modules/cloudsql-instance"
name = "test-db-no-policy-password"
root_password = {
password = "Qy[E7N&Jv49u[F9jf3Ec"
}
}
module "db-no-policy-random" {
source = "../modules/cloudsql-instance"
root_password = {
random_password = true
}
} They all appeared to work fine. The validation caught the following error: module "db-both" {
source = "../modules/cloudsql-instance"
root_password = {
password = "xyzzy"
random_password = true
}
} error
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks @lyricnz!
Per #2885
NOTE: this changes the type of
root_password
variable from a string (default null) to an object withpassword
(same behaviour as old string) andrandom_password
attributes (overridepassword
with a randomly-generated password). if value was not previously provided, default behaviour is the same.Checklist
I applicable, I acknowledge that I have:
terraform fmt
on all modified filestools/tfdoc.py