Add gc_policy to Bigtable module.

Column families have now a new property, to specify the garbage collection
policy. A new option also allows to set a default policy if none is specified.

This changes the previous syntax for column families, that was helpful since the
policy is column-family specific, the new syntax makes it easier to specify a
policy per column family.
This commit is contained in:
Israel Herraiz
2022-12-22 21:04:42 +01:00
parent 008828f2d8
commit 32bee7104e
5 changed files with 145 additions and 23 deletions

View File

@@ -19,7 +19,7 @@ variable "autoscaling_config" {
type = object({
min_nodes = number
max_nodes = number
cpu_target = number,
cpu_target = number
storage_target = optional(number, null)
})
default = null
@@ -31,6 +31,18 @@ variable "cluster_id" {
default = "europe-west1"
}
variable "default_gc_policy" {
description = "Default garbage collection policy, to be applied to all column families and all tables. Can be override in the tables variable for specific column families."
type = object({
deletion_policy = optional(string)
gc_rules = optional(string)
mode = optional(string)
max_age = optional(string)
max_version = optional(string)
})
default = null
}
variable "deletion_protection" {
description = "Whether or not to allow Terraform to destroy the instance. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply that would delete the instance will fail."
default = true
@@ -41,6 +53,7 @@ variable "display_name" {
default = null
}
variable "iam" {
description = "IAM bindings for topic in {ROLE => [MEMBERS]} format."
type = map(list(string))
@@ -79,8 +92,17 @@ variable "tables" {
description = "Tables to be created in the BigTable instance."
nullable = false
type = map(object({
split_keys = optional(list(string), [])
column_families = optional(list(string), [])
split_keys = optional(list(string), [])
column_families = optional(map(object(
{
gc_policy = optional(object({
deletion_policy = optional(string)
gc_rules = optional(string)
mode = optional(string)
max_age = optional(string)
max_version = optional(string)
}), null)
})), {})
}))
default = {}
}