fleet/infrastructure/dogfood/terraform/gcp/mysql.tf
Zachary Winnerman 2fbe53b6c9
Reorg infrastructure and add changes for frontend's loadtesting environment (#4947)
* Reorganized infrastructure, updated for frontend's loadtesting

* Add changes suggested by @chiiph

* Moved files per suggestion by Ben

* Update docs with new links

* Add config for multi account assume role
2022-04-12 12:49:00 -04:00

47 lines
1.2 KiB
HCL

resource "random_password" "fleet-db-user-pw" {
length = 12
}
module "fleet-mysql" {
source = "GoogleCloudPlatform/sql-db/google//modules/mysql"
version = "9.0.0"
name = "${var.prefix}-mysql"
random_instance_name = true
project_id = var.project_id
deletion_protection = false
additional_users = [
{
name = var.db_user
password = random_password.fleet-db-user-pw.result
host = "% (any host)"
type = "BUILT_IN"
}
]
ip_configuration = {
ipv4_enabled = false
# We never set authorized networks, we need all connections via the
# public IP to be mediated by Cloud SQL.
authorized_networks = []
require_ssl = false
private_network = module.vpc.network_self_link
}
database_version = var.db_version
region = var.region
zone = var.db_zone
tier = var.db_tier
additional_databases = [
{
name = var.db_name
charset = "utf8mb4"
collation = "utf8mb4_general_ci"
}
]
// Optional: used to enforce ordering in the creation of resources.
module_depends_on = [module.private-service-access.peering_completed]
}