Skip to content

Commit c9f0014

Browse files
feat: Adding flag for enabling data cache in MSSQL module (#642)
Co-authored-by: Imran Nayer <[email protected]>
1 parent f59328e commit c9f0014

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

modules/mssql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module "mssql" {
4040
| backup\_configuration | The database backup configuration. | <pre>object({<br> binary_log_enabled = bool<br> enabled = bool<br> point_in_time_recovery_enabled = bool<br> start_time = string<br> transaction_log_retention_days = string<br> retained_backups = number<br> retention_unit = string<br> })</pre> | <pre>{<br> "binary_log_enabled": null,<br> "enabled": false,<br> "point_in_time_recovery_enabled": null,<br> "retained_backups": null,<br> "retention_unit": null,<br> "start_time": null,<br> "transaction_log_retention_days": null<br>}</pre> | no |
4141
| connector\_enforcement | Enforce that clients use the connector library | `bool` | `false` | no |
4242
| create\_timeout | The optional timeout that is applied to limit long database creates. | `string` | `"30m"` | no |
43+
| 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 |
4344
| database\_flags | The database flags for the Cloud SQL. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags) | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
4445
| database\_version | The database version to use: SQLSERVER\_2017\_STANDARD, SQLSERVER\_2017\_ENTERPRISE, SQLSERVER\_2017\_EXPRESS, or SQLSERVER\_2017\_WEB | `string` | `"SQLSERVER_2017_STANDARD"` | no |
4546
| db\_charset | The charset for the default database | `string` | `""` | no |

modules/mssql/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ resource "google_sql_database_instance" "default" {
8080
}
8181
}
8282
}
83+
dynamic "data_cache_config" {
84+
for_each = var.edition == "ENTERPRISE_PLUS" && var.data_cache_enabled ? ["cache_enabled"] : []
85+
content {
86+
data_cache_enabled = var.data_cache_enabled
87+
}
88+
}
8389
dynamic "deny_maintenance_period" {
8490
for_each = local.is_secondary_instance ? [] : var.deny_maintenance_period
8591
content {

modules/mssql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ variable "database_flags" {
171171
default = []
172172
}
173173

174+
variable "data_cache_enabled" {
175+
description = "Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions"
176+
type = bool
177+
default = false
178+
}
179+
174180
variable "active_directory_config" {
175181
description = "Active domain that the SQL instance will join."
176182
type = map(string)

0 commit comments

Comments
 (0)