Skip to content

Commit

Permalink
adding data_cache to postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
nityanavali1 committed Oct 23, 2023
1 parent 9251c8b commit e734ea2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
| backup\_configuration | The backup\_configuration settings subblock for the database setings | <pre>object({<br> enabled = optional(bool, false)<br> start_time = optional(string)<br> location = optional(string)<br> point_in_time_recovery_enabled = optional(bool, false)<br> transaction_log_retention_days = optional(string)<br> retained_backups = optional(number)<br> retention_unit = optional(string)<br> })</pre> | `{}` | no |
| connector\_enforcement | Enforce that clients use the connector library | `bool` | `false` | no |
| create\_timeout | The optional timout that is applied to limit long database creates. | `string` | `"30m"` | no |
| data\_cache\_enabled | Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE\_PLUS tier and supported database\_versions | `bool` | `false` | no |
| 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 master instance. See [more details](https://cloud.google.com/sql/docs/postgres/flags) | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| database\_version | The database version to use | `string` | n/a | yes |
Expand Down
6 changes: 6 additions & 0 deletions modules/postgresql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ resource "google_sql_database_instance" "default" {
}
}
}
dynamic "data_cache_config" {
for_each = var.edition == "ENTERPRISE_PLUS" && var.data_cache_enabled ? ["cache_enabled"] : []
content {
data_cache_enabled = var.data_cache_enabled
}
}
dynamic "deny_maintenance_period" {
for_each = var.deny_maintenance_period
content {
Expand Down
6 changes: 6 additions & 0 deletions modules/postgresql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,9 @@ variable "connector_enforcement" {
type = bool
default = false
}

variable "data_cache_enabled" {
description = "Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions"
type = bool
default = false
}

0 comments on commit e734ea2

Please sign in to comment.