File tree Expand file tree Collapse file tree 2 files changed +28
-13
lines changed Expand file tree Collapse file tree 2 files changed +28
-13
lines changed Original file line number Diff line number Diff line change @@ -188,19 +188,27 @@ resource "random_password" "user-password" {
188188 name = google_sql_database_instance.default.name
189189 }
190190
191- length = 32
192- special = var. enable_random_password_special
193- depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
191+ min_lower = 1
192+ min_numeric = 1
193+ min_upper = 1
194+ length = var. password_validation_policy_config != null ? (var. password_validation_policy_config . min_length != null ? var. password_validation_policy_config . min_length + 4 : 32 ) : 32
195+ special = var. enable_random_password_special ? true : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? true : false ) : false )
196+ min_special = var. enable_random_password_special ? 1 : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? 1 : 0 ) : 0 )
197+ depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
194198}
195199
196200resource "random_password" "additional_passwords" {
197201 for_each = local. users
198202 keepers = {
199203 name = google_sql_database_instance.default.name
200204 }
201- length = 32
202- special = var. enable_random_password_special
203- depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
205+ min_lower = 1
206+ min_numeric = 1
207+ min_upper = 1
208+ length = var. password_validation_policy_config != null ? (var. password_validation_policy_config . min_length != null ? var. password_validation_policy_config . min_length + 4 : 32 ) : 32
209+ special = var. enable_random_password_special ? true : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? true : false ) : false )
210+ min_special = var. enable_random_password_special ? 1 : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? 1 : 0 ) : 0 )
211+ depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
204212}
205213
206214resource "google_sql_user" "default" {
Original file line number Diff line number Diff line change @@ -197,20 +197,27 @@ resource "random_password" "user-password" {
197197 keepers = {
198198 name = google_sql_database_instance.default.name
199199 }
200-
201- length = 32
202- special = var. enable_random_password_special
203- depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
200+ min_lower = 1
201+ min_numeric = 1
202+ min_upper = 1
203+ length = var. password_validation_policy_config != null ? (var. password_validation_policy_config . min_length != null ? var. password_validation_policy_config . min_length + 4 : 32 ) : 32
204+ special = var. enable_random_password_special ? true : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? true : false ) : false )
205+ min_special = var. enable_random_password_special ? 1 : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? 1 : 0 ) : 0 )
206+ depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
204207}
205208
206209resource "random_password" "additional_passwords" {
207210 for_each = local. users
208211 keepers = {
209212 name = google_sql_database_instance.default.name
210213 }
211- length = 32
212- special = var. enable_random_password_special
213- depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
214+ min_lower = 1
215+ min_numeric = 1
216+ min_upper = 1
217+ length = var. password_validation_policy_config != null ? (var. password_validation_policy_config . min_length != null ? var. password_validation_policy_config . min_length + 4 : 32 ) : 32
218+ special = var. enable_random_password_special ? true : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? true : false ) : false )
219+ min_special = var. enable_random_password_special ? 1 : (var. password_validation_policy_config != null ? (var. password_validation_policy_config . complexity != " COMPLEXITY_UNSPECIFIED" ? 1 : 0 ) : 0 )
220+ depends_on = [null_resource. module_depends_on , google_sql_database_instance . default ]
214221}
215222
216223resource "google_sql_user" "default" {
You can’t perform that action at this time.
0 commit comments