Skip to content

Commit 01950a7

Browse files
Enable TLS by default
Enable TLS by default.
1 parent 5084c1e commit 01950a7

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
@@ -62,7 +62,7 @@ No resources.
6262
| <a name="input_gke_config"></a> [gke\_config](#input\_gke\_config) | GKE cluster configuration. Make sure to use large enough machine types for your Materialize instances. | <pre>object({<br/> node_count = number<br/> machine_type = string<br/> disk_size_gb = number<br/> min_nodes = number<br/> max_nodes = number<br/> })</pre> | <pre>{<br/> "disk_size_gb": 50,<br/> "machine_type": "e2-standard-4",<br/> "max_nodes": 2,<br/> "min_nodes": 1,<br/> "node_count": 1<br/>}</pre> | no |
6363
| <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 |
6464
| <a name="input_helm_values"></a> [helm\_values](#input\_helm\_values) | Values to pass to the Helm chart | `any` | `{}` | no |
65-
| <a name="input_install_cert_manager"></a> [install\_cert\_manager](#input\_install\_cert\_manager) | Whether to install cert-manager. | `bool` | `false` | no |
65+
| <a name="input_install_cert_manager"></a> [install\_cert\_manager](#input\_install\_cert\_manager) | Whether to install cert-manager. | `bool` | `true` | no |
6666
| <a name="input_install_materialize_operator"></a> [install\_materialize\_operator](#input\_install\_materialize\_operator) | Whether to install the Materialize operator | `bool` | `true` | no |
6767
| <a name="input_install_metrics_server"></a> [install\_metrics\_server](#input\_install\_metrics\_server) | Whether to install the metrics-server for the Materialize Console. Defaults to false since GKE installs one by default in the kube-system namespace. Only set to true if the GKE cluster was deployed with [monitoring explicitly turned off](https://cloud.google.com/kubernetes-engine/docs/how-to/configure-metrics#:~:text=To%20disable%20system%20metric%20collection,for%20the%20%2D%2Dmonitoring%20flag). Refer to the [GKE docs](https://cloud.google.com/kubernetes-engine/docs/how-to/configure-metrics#:~:text=To%20disable%20system%20metric%20collection,for%20the%20%2D%2Dmonitoring%20flag) for more information, including impact to GKE customer support efforts. | `bool` | `false` | no |
6868
| <a name="input_labels"></a> [labels](#input\_labels) | Labels to apply to all resources | `map(string)` | `{}` | no |
@@ -76,7 +76,7 @@ No resources.
7676
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | The ID of the project where resources will be created | `string` | n/a | yes |
7777
| <a name="input_region"></a> [region](#input\_region) | The region where resources will be created | `string` | `"us-central1"` | no |
7878
| <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 |
79-
| <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 |
79+
| <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 |
8080

8181
## Outputs
8282

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

102102
#### TLS support
103103

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

106106
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.
107107

108-
###### To enable installation of `cert-manager` and configuration of the self-signed `ClusterIssuer`
109-
1. Set `install_cert_manager` to `true`.
110-
1. Run `terraform apply`.
111-
1. Set `use_self_signed_cluster_issuer` to `true`.
112-
1. Run `terraform apply`.
108+
## Upgrade Notes
113109

114-
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`.
110+
#### v0.3.0
111+
112+
We now install `cert-manager` and configure a self-signed `ClusterIssuer` by default.
113+
114+
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.
115+
116+
For existing users upgrading Materialize instances not previously configured for TLS:
117+
1. Leave `install_cert_manager` at its default of `true`.
118+
2. Set `use_self_signed_cluster_issuer` to `false`.
119+
3. Run `terraform apply`. This will install cert-manager and its CRDs.
120+
4. Set `use_self_signed_cluster_issuer` back to `true` (the default).
121+
5. Update the `request_rollout` field of the Materialize instance.
122+
6. Run `terraform apply`. This will generate the certificates and configure your Materialize instance to use them.
115123
<!-- END_TF_DOCS -->

docs/footer.md

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

99
#### TLS support
1010

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

1313
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.
1414

15-
###### To enable installation of `cert-manager` and configuration of the self-signed `ClusterIssuer`
16-
1. Set `install_cert_manager` to `true`.
17-
1. Run `terraform apply`.
18-
1. Set `use_self_signed_cluster_issuer` to `true`.
19-
1. Run `terraform apply`.
15+
## Upgrade Notes
2016

21-
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`.
17+
#### v0.3.0
18+
19+
We now install `cert-manager` and configure a self-signed `ClusterIssuer` by default.
20+
21+
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.
22+
23+
For existing users upgrading Materialize instances not previously configured for TLS:
24+
1. Leave `install_cert_manager` at its default of `true`.
25+
2. Set `use_self_signed_cluster_issuer` to `false`.
26+
3. Run `terraform apply`. This will install cert-manager and its CRDs.
27+
4. Set `use_self_signed_cluster_issuer` back to `true` (the default).
28+
5. Update the `request_rollout` field of the Materialize instance.
29+
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
@@ -175,11 +175,11 @@ variable "materialize_instances" {
175175
variable "install_cert_manager" {
176176
description = "Whether to install cert-manager."
177177
type = bool
178-
default = false
178+
default = true
179179
}
180180

181181
variable "use_self_signed_cluster_issuer" {
182-
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."
182+
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."
183183
type = bool
184-
default = false
184+
default = true
185185
}

main.tf

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

@@ -156,7 +156,7 @@ locals {
156156
}
157157
}
158158
}
159-
tls = var.use_self_signed_cluster_issuer ? {
159+
tls = (var.use_self_signed_cluster_issuer && length(var.materialize_instances) > 0) ? {
160160
defaultCertificateSpecs = {
161161
balancerdExternal = {
162162
dnsNames = [

variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ variable "install_metrics_server" {
163163
variable "install_cert_manager" {
164164
description = "Whether to install cert-manager."
165165
type = bool
166-
default = false
166+
default = true
167167
}
168168

169169
variable "use_self_signed_cluster_issuer" {
170-
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."
170+
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."
171171
type = bool
172-
default = false
172+
default = true
173173
}
174174

175175
variable "cert_manager_namespace" {

0 commit comments

Comments
 (0)