From 8d0e652067df1dd545109864f478190f72683f81 Mon Sep 17 00:00:00 2001 From: Bobby Iliev Date: Fri, 28 Feb 2025 13:11:04 +0200 Subject: [PATCH] Add force database recreate option --- README.md | 4 ++-- examples/simple/main.tf | 15 ++++++++------- main.tf | 11 ++++++----- variables.tf | 23 ++++++++++++----------- 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 37279ed..1ad4c3a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ The module has been tested with: | [database](#module\_database) | ./modules/database | n/a | | [eks](#module\_eks) | ./modules/eks | n/a | | [networking](#module\_networking) | ./modules/networking | n/a | -| [operator](#module\_operator) | github.com/MaterializeInc/terraform-helm-materialize | v0.1.7 | +| [operator](#module\_operator) | github.com/MaterializeInc/terraform-helm-materialize | v0.1.8 | | [storage](#module\_storage) | ./modules/storage | n/a | ## Resources @@ -76,7 +76,7 @@ The module has been tested with: | [install\_metrics\_server](#input\_install\_metrics\_server) | Whether to install the metrics-server for the Materialize Console | `bool` | `true` | no | | [kubernetes\_namespace](#input\_kubernetes\_namespace) | The Kubernetes namespace for the Materialize resources | `string` | `"materialize-environment"` | no | | [log\_group\_name\_prefix](#input\_log\_group\_name\_prefix) | Prefix for the CloudWatch log group name (will be combined with environment name) | `string` | `"materialize"` | no | -| [materialize\_instances](#input\_materialize\_instances) | Configuration for Materialize instances |
list(object({
name = string
namespace = optional(string)
database_name = string
environmentd_version = optional(string, "v0.130.4")
cpu_request = optional(string, "1")
memory_request = optional(string, "1Gi")
memory_limit = optional(string, "1Gi")
create_database = optional(bool, true)
in_place_rollout = optional(bool, false)
request_rollout = optional(string)
force_rollout = optional(string)
}))
| `[]` | no | +| [materialize\_instances](#input\_materialize\_instances) | Configuration for Materialize instances |
list(object({
name = string
namespace = optional(string)
database_name = string
environmentd_version = optional(string, "v0.130.4")
cpu_request = optional(string, "1")
memory_request = optional(string, "1Gi")
memory_limit = optional(string, "1Gi")
create_database = optional(bool, true)
database_force_recreate = optional(bool, false)
in_place_rollout = optional(bool, false)
request_rollout = optional(string)
force_rollout = optional(string)
}))
| `[]` | no | | [metrics\_retention\_days](#input\_metrics\_retention\_days) | Number of days to retain CloudWatch metrics | `number` | `7` | no | | [namespace](#input\_namespace) | Namespace for all resources, usually the organization or project name | `string` | n/a | yes | | [network\_id](#input\_network\_id) | The ID of the VPC in which resources will be deployed. Only used if create\_vpc is false. | `string` | `""` | no | diff --git a/examples/simple/main.tf b/examples/simple/main.tf index 60d6c92..f71f0ba 100644 --- a/examples/simple/main.tf +++ b/examples/simple/main.tf @@ -83,13 +83,14 @@ variable "environment" { variable "materialize_instances" { description = "List of Materialize instances to be created." type = list(object({ - name = string - namespace = string - database_name = string - cpu_request = string - memory_request = string - memory_limit = string - create_database = optional(bool) + name = string + namespace = string + database_name = string + cpu_request = string + memory_request = string + memory_limit = string + create_database = optional(bool) + database_force_recreate = optional(bool) })) default = [] } diff --git a/main.tf b/main.tf index dac3a11..353d688 100644 --- a/main.tf +++ b/main.tf @@ -79,7 +79,7 @@ module "database" { } module "operator" { - source = "github.com/MaterializeInc/terraform-helm-materialize?ref=v0.1.7" + source = "github.com/MaterializeInc/terraform-helm-materialize?ref=v0.1.8" count = var.install_materialize_operator ? 1 : 0 @@ -145,10 +145,11 @@ locals { instances = [ for instance in var.materialize_instances : { - name = instance.name - namespace = instance.namespace - database_name = instance.database_name - create_database = instance.create_database + name = instance.name + namespace = instance.namespace + database_name = instance.database_name + create_database = instance.create_database + database_force_recreate = instance.database_force_recreate metadata_backend_url = format( "postgres://%s:%s@%s/%s?sslmode=require", diff --git a/variables.tf b/variables.tf index 0021c96..dce39a1 100644 --- a/variables.tf +++ b/variables.tf @@ -309,17 +309,18 @@ variable "helm_values" { variable "materialize_instances" { description = "Configuration for Materialize instances" type = list(object({ - name = string - namespace = optional(string) - database_name = string - environmentd_version = optional(string, "v0.130.4") - cpu_request = optional(string, "1") - memory_request = optional(string, "1Gi") - memory_limit = optional(string, "1Gi") - create_database = optional(bool, true) - in_place_rollout = optional(bool, false) - request_rollout = optional(string) - force_rollout = optional(string) + name = string + namespace = optional(string) + database_name = string + environmentd_version = optional(string, "v0.130.4") + cpu_request = optional(string, "1") + memory_request = optional(string, "1Gi") + memory_limit = optional(string, "1Gi") + create_database = optional(bool, true) + database_force_recreate = optional(bool, false) + in_place_rollout = optional(bool, false) + request_rollout = optional(string) + force_rollout = optional(string) })) default = []