Open KiranK-4 opened 2 months ago
@KiranK-4 what are the values passed in var.db_version
?
I see the same issue. I keep getting MYSQL 8.0
created while I have specified POSTGRES_16_3
However, when I just specify 16
as version, I get the correct DB created.
Here's the HCL code:
module "sql" {
providers = {
google = google.use1
}
source = "terraform-google-modules/sql-db/google//modules/postgresql"
version = "~> 21.0"
name = "${var.folder}-${var.environment}-${var.region_short_name}-db"
project_id = local.project_id
database_version = "POSTGRES_16_3"
region = var.region
}
I think variable description is misleading. It is expecting
9_6, 10, 11, 12, 13, 14, 15, 16 etc
Here is the logic
can(regex("\\d", substr(var.database_version, 0, 1))) ? format("POSTGRES_%s", var.database_version) : replace(var.database_version, substr(var.database_version, 0, 8), "POSTGRES")
TL;DR
Using the Postgres module creates a MySQL Instance using the same values provided in the README.md
Expected behavior
It should create a POSTGRES_9_6 database instance
Observed behavior
It creates MySQL 8.0 version Instance
Terraform Configuration
Terraform Version
Additional information
No response