Add cluster replicas to Bigtable module.

This adds the possiblity to define several clusters in a Bigtable instance,
which enables replication in Bigtable.

Some of the configurations options are moved inside a `map` that defines the
properties of each cluster.

These changes alter the interface of the module, so any previous code using this
module will have to adapt to the new options interface.
This commit is contained in:
Israel Herraiz
2022-12-28 19:53:17 +01:00
parent 39242c3947
commit 20579394b8
4 changed files with 139 additions and 86 deletions

View File

@@ -14,23 +14,33 @@
* limitations under the License.
*/
variable "autoscaling_config" {
description = "Settings for autoscaling of the instance. If you set this variable, the variable num_nodes is ignored."
variable "clusters" {
description = "Clusters to be created in the BigTable instance. Set more than one cluster to enable replication. If you set autoscaling, num_nodes will be ignored."
nullable = false
type = map(object({
zone = optional(string)
storage_type = optional(string)
num_nodes = optional(number)
autoscaling = optional(object({
min_nodes = number
max_nodes = number
cpu_target = number
storage_target = optional(number)
}))
}))
}
variable "default_autoscaling" {
description = "Default settings for autoscaling of clusters. This will be the default autoscaling for any cluster not specifying any autoscaling details."
type = object({
min_nodes = number
max_nodes = number
cpu_target = number
storage_target = optional(number, null)
storage_target = optional(number)
})
default = null
}
variable "cluster_id" {
description = "The ID of the Cloud Bigtable cluster."
type = string
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({
@@ -70,23 +80,11 @@ variable "name" {
type = string
}
variable "num_nodes" {
description = "The number of nodes in your Cloud Bigtable cluster. This value is ignored if you are using autoscaling."
type = number
default = 1
}
variable "project_id" {
description = "Id of the project where datasets will be created."
type = string
}
variable "storage_type" {
description = "The storage type to use."
type = string
default = "SSD"
}
variable "tables" {
description = "Tables to be created in the BigTable instance."
nullable = false
@@ -105,8 +103,3 @@ variable "tables" {
}))
default = {}
}
variable "zone" {
description = "The zone to create the Cloud Bigtable cluster in."
type = string
}