diff --git a/examples/postgresql-public-iam/main.tf b/examples/postgresql-public-iam/main.tf index b1d35982..d690407f 100644 --- a/examples/postgresql-public-iam/main.tf +++ b/examples/postgresql-public-iam/main.tf @@ -23,7 +23,7 @@ module "postgresql-db" { project_id = var.project_id zone = "us-central1-c" region = "us-central1" - tier = "db-f1-micro" + tier = "db-custom-2-13312" deletion_protection = false diff --git a/examples/postgresql-public/main.tf b/examples/postgresql-public/main.tf index b0c5a78f..38a8e889 100644 --- a/examples/postgresql-public/main.tf +++ b/examples/postgresql-public/main.tf @@ -23,7 +23,7 @@ module "postgresql-db" { project_id = var.project_id zone = "us-central1-c" region = "us-central1" - tier = "db-f1-micro" + tier = "db-custom-2-13312" deletion_protection = false diff --git a/modules/mysql/main.tf b/modules/mysql/main.tf index 3731886a..c7b60ed9 100644 --- a/modules/mysql/main.tf +++ b/modules/mysql/main.tf @@ -171,24 +171,32 @@ resource "random_id" "additional_passwords" { } resource "google_sql_user" "default" { - count = var.enable_default_user ? 1 : 0 - name = var.user_name - project = var.project_id - instance = google_sql_database_instance.default.name - host = var.user_host - password = var.user_password == "" ? random_id.user-password.hex : var.user_password - depends_on = [null_resource.module_depends_on, google_sql_database_instance.default] + count = var.enable_default_user ? 1 : 0 + name = var.user_name + project = var.project_id + instance = google_sql_database_instance.default.name + host = var.user_host + password = var.user_password == "" ? random_id.user-password.hex : var.user_password + depends_on = [ + null_resource.module_depends_on, + google_sql_database_instance.default, + google_sql_database_instance.replicas, + ] } resource "google_sql_user" "additional_users" { - for_each = local.users - project = var.project_id - name = each.value.name - password = lookup(each.value, "password", random_id.user-password.hex) - host = lookup(each.value, "host", var.user_host) - instance = google_sql_database_instance.default.name - type = lookup(each.value, "type", "BUILT_IN") - depends_on = [null_resource.module_depends_on, google_sql_database_instance.default] + for_each = local.users + project = var.project_id + name = each.value.name + password = lookup(each.value, "password", random_id.user-password.hex) + host = lookup(each.value, "host", var.user_host) + instance = google_sql_database_instance.default.name + type = lookup(each.value, "type", "BUILT_IN") + depends_on = [ + null_resource.module_depends_on, + google_sql_database_instance.default, + google_sql_database_instance.replicas, + ] } resource "null_resource" "module_depends_on" { diff --git a/modules/postgresql/main.tf b/modules/postgresql/main.tf index e9ff41dc..52f28277 100644 --- a/modules/postgresql/main.tf +++ b/modules/postgresql/main.tf @@ -182,21 +182,29 @@ resource "random_id" "additional_passwords" { } resource "google_sql_user" "default" { - count = var.enable_default_user ? 1 : 0 - name = var.user_name - project = var.project_id - instance = google_sql_database_instance.default.name - password = var.user_password == "" ? random_id.user-password.hex : var.user_password - depends_on = [null_resource.module_depends_on, google_sql_database_instance.default] + count = var.enable_default_user ? 1 : 0 + name = var.user_name + project = var.project_id + instance = google_sql_database_instance.default.name + password = var.user_password == "" ? random_id.user-password.hex : var.user_password + depends_on = [ + null_resource.module_depends_on, + google_sql_database_instance.default, + google_sql_database_instance.replicas, + ] } resource "google_sql_user" "additional_users" { - for_each = local.users - project = var.project_id - name = each.value.name - password = coalesce(each.value["password"], random_id.additional_passwords[each.value.name].hex) - instance = google_sql_database_instance.default.name - depends_on = [null_resource.module_depends_on, google_sql_database_instance.default] + for_each = local.users + project = var.project_id + name = each.value.name + password = coalesce(each.value["password"], random_id.additional_passwords[each.value.name].hex) + instance = google_sql_database_instance.default.name + depends_on = [ + null_resource.module_depends_on, + google_sql_database_instance.default, + google_sql_database_instance.replicas, + ] } resource "google_project_iam_member" "iam_binding" { diff --git a/test/integration/postgresql-public-iam/controls/pg.rb b/test/integration/postgresql-public-iam/controls/pg.rb index a55a6ea2..4f448a20 100644 --- a/test/integration/postgresql-public-iam/controls/pg.rb +++ b/test/integration/postgresql-public-iam/controls/pg.rb @@ -16,7 +16,7 @@ basename = attribute('name') db_version = "POSTGRES_9_6" region = "us-central1" -tier = "db-f1-micro" +tier = "db-custom-2-13312" public_ip_address = attribute('public_ip_address') activation_policy = "ALWAYS" diff --git a/test/integration/postgresql-public/controls/pg.rb b/test/integration/postgresql-public/controls/pg.rb index 9f132740..62bcd670 100644 --- a/test/integration/postgresql-public/controls/pg.rb +++ b/test/integration/postgresql-public/controls/pg.rb @@ -16,7 +16,7 @@ basename = attribute('name') db_version = "POSTGRES_9_6" region = "us-central1" -tier = "db-f1-micro" +tier = "db-custom-2-13312" public_ip_address = attribute('public_ip_address') activation_policy = "ALWAYS"