Skip to content

Commit 9996e18

Browse files
Enable TLS by default
Enable TLS by default.
1 parent 1863c6f commit 9996e18

File tree

5 files changed

+40
-24
lines changed

5 files changed

+40
-24
lines changed

README.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ No resources.
106106
| <a name="input_database_config"></a> [database\_config](#input\_database\_config) | Azure Database for PostgreSQL configuration | <pre>object({<br/> sku_name = optional(string, "GP_Standard_D2s_v3")<br/> postgres_version = optional(string, "15")<br/> password = string<br/> username = optional(string, "materialize")<br/> db_name = optional(string, "materialize")<br/> })</pre> | n/a | yes |
107107
| <a name="input_helm_chart"></a> [helm\_chart](#input\_helm\_chart) | Chart name from repository or local path to chart. For local charts, set the path to the chart directory. | `string` | `"materialize-operator"` | no |
108108
| <a name="input_helm_values"></a> [helm\_values](#input\_helm\_values) | Additional Helm values to merge with defaults | `any` | `{}` | no |
109-
| <a name="input_install_cert_manager"></a> [install\_cert\_manager](#input\_install\_cert\_manager) | Whether to install cert-manager. | `bool` | `false` | no |
109+
| <a name="input_install_cert_manager"></a> [install\_cert\_manager](#input\_install\_cert\_manager) | Whether to install cert-manager. | `bool` | `true` | no |
110110
| <a name="input_install_materialize_operator"></a> [install\_materialize\_operator](#input\_install\_materialize\_operator) | Whether to install the Materialize operator | `bool` | `true` | no |
111111
| <a name="input_location"></a> [location](#input\_location) | The location where resources will be created | `string` | `"eastus2"` | no |
112112
| <a name="input_materialize_instances"></a> [materialize\_instances](#input\_materialize\_instances) | Configuration for Materialize instances | <pre>list(object({<br/> name = string<br/> namespace = optional(string)<br/> database_name = string<br/> environmentd_version = optional(string)<br/> cpu_request = optional(string, "1")<br/> memory_request = optional(string, "1Gi")<br/> memory_limit = optional(string, "1Gi")<br/> create_database = optional(bool, true)<br/> in_place_rollout = optional(bool, false)<br/> request_rollout = optional(string)<br/> force_rollout = optional(string)<br/> balancer_memory_request = optional(string, "256Mi")<br/> balancer_memory_limit = optional(string, "256Mi")<br/> balancer_cpu_request = optional(string, "100m")<br/> }))</pre> | `[]` | no |
@@ -119,7 +119,7 @@ No resources.
119119
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | The name of the resource group | `string` | n/a | yes |
120120
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply to all resources | `map(string)` | `{}` | no |
121121
| <a name="input_use_local_chart"></a> [use\_local\_chart](#input\_use\_local\_chart) | Whether to use a local chart instead of one from a repository | `bool` | `false` | no |
122-
| <a name="input_use_self_signed_cluster_issuer"></a> [use\_self\_signed\_cluster\_issuer](#input\_use\_self\_signed\_cluster\_issuer) | Whether to install and use a self-signed ClusterIssuer for TLS. Due to limitations in Terraform, this may not be enabled before the cert-manager CRDs are installed. | `bool` | `false` | no |
122+
| <a name="input_use_self_signed_cluster_issuer"></a> [use\_self\_signed\_cluster\_issuer](#input\_use\_self\_signed\_cluster\_issuer) | Whether to install and use a self-signed ClusterIssuer for TLS. To work around limitations in Terraform, this will be treated as `false` if no materialize instances are defined. | `bool` | `true` | no |
123123

124124
## Outputs
125125

@@ -155,15 +155,23 @@ Access to the web console is through the console pods on port 8080.
155155

156156
#### TLS support
157157

158-
For example purposes, optional TLS support is provided by using `cert-manager` and a self-signed `ClusterIssuer`.
158+
TLS support is provided by using `cert-manager` and a self-signed `ClusterIssuer`.
159159

160160
More advanced TLS support using user-provided CAs or per-Materialize `Issuer`s are out of scope for this Terraform module. Please refer to the [cert-manager documentation](https://cert-manager.io/docs/configuration/) for detailed guidance on more advanced usage.
161161

162-
###### To enable installation of `cert-manager` and configuration of the self-signed `ClusterIssuer`
163-
1. Set `install_cert_manager` to `true`.
164-
1. Run `terraform apply`.
165-
1. Set `use_self_signed_cluster_issuer` to `true`.
166-
1. Run `terraform apply`.
162+
## Upgrade Notes
167163

168-
Due to limitations in Terraform, it cannot plan Kubernetes resources using CRDs that do not exist yet. We need to first install `cert-manager` in the first `terraform apply`, before defining any `ClusterIssuer` or `Certificate` resources which get created in the second `terraform apply`.
164+
#### v0.3.0
165+
166+
We now install `cert-manager` and configure a self-signed `ClusterIssuer` by default.
167+
168+
Due to limitations in Terraform, it cannot plan Kubernetes resources using CRDs that do not exist yet. We have worked around this for new users by only generating the certificate resources when creating Materialize instances that use them, which also cannot be created on the first run.
169+
170+
For existing users upgrading Materialize instances not previously configured for TLS:
171+
1. Leave `install_cert_manager` at its default of `true`.
172+
2. Set `use_self_signed_cluster_issuer` to `false`.
173+
3. Run `terraform apply`. This will install cert-manager and its CRDs.
174+
4. Set `use_self_signed_cluster_issuer` back to `true` (the default).
175+
5. Update the `request_rollout` field of the Materialize instance.
176+
6. Run `terraform apply`. This will generate the certificates and configure your Materialize instance to use them.
169177
<!-- END_TF_DOCS -->

docs/footer.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,22 @@ Access to the web console is through the console pods on port 8080.
1818

1919
#### TLS support
2020

21-
For example purposes, optional TLS support is provided by using `cert-manager` and a self-signed `ClusterIssuer`.
21+
TLS support is provided by using `cert-manager` and a self-signed `ClusterIssuer`.
2222

2323
More advanced TLS support using user-provided CAs or per-Materialize `Issuer`s are out of scope for this Terraform module. Please refer to the [cert-manager documentation](https://cert-manager.io/docs/configuration/) for detailed guidance on more advanced usage.
2424

25-
###### To enable installation of `cert-manager` and configuration of the self-signed `ClusterIssuer`
26-
1. Set `install_cert_manager` to `true`.
27-
1. Run `terraform apply`.
28-
1. Set `use_self_signed_cluster_issuer` to `true`.
29-
1. Run `terraform apply`.
25+
## Upgrade Notes
3026

31-
Due to limitations in Terraform, it cannot plan Kubernetes resources using CRDs that do not exist yet. We need to first install `cert-manager` in the first `terraform apply`, before defining any `ClusterIssuer` or `Certificate` resources which get created in the second `terraform apply`.
27+
#### v0.3.0
28+
29+
We now install `cert-manager` and configure a self-signed `ClusterIssuer` by default.
30+
31+
Due to limitations in Terraform, it cannot plan Kubernetes resources using CRDs that do not exist yet. We have worked around this for new users by only generating the certificate resources when creating Materialize instances that use them, which also cannot be created on the first run.
32+
33+
For existing users upgrading Materialize instances not previously configured for TLS:
34+
1. Leave `install_cert_manager` at its default of `true`.
35+
2. Set `use_self_signed_cluster_issuer` to `false`.
36+
3. Run `terraform apply`. This will install cert-manager and its CRDs.
37+
4. Set `use_self_signed_cluster_issuer` back to `true` (the default).
38+
5. Update the `request_rollout` field of the Materialize instance.
39+
6. Run `terraform apply`. This will generate the certificates and configure your Materialize instance to use them.

examples/simple/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ variable "materialize_instances" {
168168
variable "install_cert_manager" {
169169
description = "Whether to install cert-manager."
170170
type = bool
171-
default = false
171+
default = true
172172
}
173173

174174
variable "use_self_signed_cluster_issuer" {
175-
description = "Whether to install and use a self-signed ClusterIssuer for TLS. Due to limitations in Terraform, this may not be enabled before the cert-manager CRDs are installed."
175+
description = "Whether to install and use a self-signed ClusterIssuer for TLS. To work around limitations in Terraform, this will be treated as `false` if no materialize instances are defined."
176176
type = bool
177-
default = false
177+
default = true
178178
}
179179

180180
# Output the Materialize instance details

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module "certificates" {
7878
install_cert_manager = var.install_cert_manager
7979
cert_manager_install_timeout = var.cert_manager_install_timeout
8080
cert_manager_chart_version = var.cert_manager_chart_version
81-
use_self_signed_cluster_issuer = var.use_self_signed_cluster_issuer
81+
use_self_signed_cluster_issuer = var.use_self_signed_cluster_issuer && length(var.materialize_instances) > 0
8282
cert_manager_namespace = var.cert_manager_namespace
8383
name_prefix = var.prefix
8484

@@ -103,7 +103,7 @@ locals {
103103
enabled = true
104104
}
105105
}
106-
tls = var.use_self_signed_cluster_issuer ? {
106+
tls = (var.use_self_signed_cluster_issuer && length(var.materialize_instances) > 0) ? {
107107
defaultCertificateSpecs = {
108108
balancerdExternal = {
109109
dnsNames = [

variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ variable "materialize_instances" {
145145
variable "install_cert_manager" {
146146
description = "Whether to install cert-manager."
147147
type = bool
148-
default = false
148+
default = true
149149
}
150150

151151
variable "use_self_signed_cluster_issuer" {
152-
description = "Whether to install and use a self-signed ClusterIssuer for TLS. Due to limitations in Terraform, this may not be enabled before the cert-manager CRDs are installed."
152+
description = "Whether to install and use a self-signed ClusterIssuer for TLS. To work around limitations in Terraform, this will be treated as `false` if no materialize instances are defined."
153153
type = bool
154-
default = false
154+
default = true
155155
}
156156

157157
variable "cert_manager_namespace" {

0 commit comments

Comments
 (0)