diff --git a/modules/postgresql/README.md b/modules/postgresql/README.md index 55106c4c..d63e871a 100644 --- a/modules/postgresql/README.md +++ b/modules/postgresql/README.md @@ -127,7 +127,7 @@ module "pg" { | database\_deletion\_policy | The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON". | `string` | `null` | no | | database\_flags | The database flags for the Cloud SQL instance. See [more details](https://cloud.google.com/sql/docs/postgres/flags) |
list(object({| `[]` | no | | database\_integration\_roles | The roles required by default database instance service account for integration with GCP services | `list(string)` | `[]` | no | -| database\_version | The database version to use | `string` | n/a | yes | +| database\_version | The database version to use. Can be 9\_6, 14, 15, 16, 17. | `string` | n/a | yes | | db\_charset | The charset for the default database | `string` | `""` | no | | db\_collation | The collation for the default database. Example: 'en\_US.UTF8' | `string` | `""` | no | | db\_name | The name of the default database to create | `string` | `"default"` | no | diff --git a/modules/postgresql/variables.tf b/modules/postgresql/variables.tf index e9201ef6..c2b7bdf2 100644 --- a/modules/postgresql/variables.tf +++ b/modules/postgresql/variables.tf @@ -44,12 +44,12 @@ variable "random_instance_name" { // required variable "database_version" { - description = "The database version to use" + description = "The database version to use. Can be 9_6, 14, 15, 16, 17." type = string validation { condition = (length(var.database_version) >= 9 && ((upper(substr(var.database_version, 0, 9)) == "POSTGRES_") && can(regex("^\\d+(?:_?\\d)*$", substr(var.database_version, 9, -1))))) || can(regex("^\\d+(?:_?\\d)*$", var.database_version)) - error_message = "The specified database version is not a valid representation of database version. Valid database versions should be like the following patterns:- \"9_6\", \"postgres_9_6\", \"POSTGRES_14\", \"POSTGRES_15\", \"POSTGRES_17\" or \"POSTGRES_17\"" + error_message = "The specified database version is not a valid representation of database version. Valid database versions should be like the following patterns:- \"9_6\", \"postgres_9_6\", \"14\", \"POSTGRES_14\", \"15\", \"POSTGRES_15\", \"16\", \"POSTGRES_16\" or \"17\", \"POSTGRES_17\"" } }
name = string
value = string
}))