Skip to content

Commit 335c62a

Browse files
authored
feat: Make creation of istio-system namespace optional (terraform-google-modules#1439)
Use try function for configmap namespace
1 parent 1530c87 commit 335c62a

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

modules/asm/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ To deploy this config:
5454
| channel | The channel to use for this ASM installation. | `string` | `""` | no |
5555
| cluster\_location | The cluster location for this ASM installation. | `string` | n/a | yes |
5656
| cluster\_name | The unique name to identify the cluster in ASM. | `string` | n/a | yes |
57+
| create\_system\_namespace | Determines whether the module creates the istio-system namespace. | `bool` | `true` | no |
5758
| enable\_cni | Determines whether to enable CNI for this ASM installation. Required to use Managed Data Plane (MDP). | `bool` | `false` | no |
5859
| enable\_fleet\_registration | Determines whether the module registers the cluster to the fleet. | `bool` | `false` | no |
5960
| enable\_mesh\_feature | Determines whether the module enables the mesh feature on the fleet. | `bool` | `false` | no |

modules/asm/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ data "google_container_cluster" "asm" {
3434
}
3535

3636
resource "kubernetes_namespace" "system" {
37+
count = var.create_system_namespace ? 1 : 0
38+
3739
metadata {
3840
name = "istio-system"
3941
}
@@ -42,7 +44,7 @@ resource "kubernetes_namespace" "system" {
4244
resource "kubernetes_config_map" "asm_options" {
4345
metadata {
4446
name = "asm-options"
45-
namespace = kubernetes_namespace.system.metadata[0].name
47+
namespace = try(kubernetes_namespace.system[0].metadata[0].name, "istio-system")
4648
}
4749

4850
data = {

modules/asm/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,9 @@ variable "module_depends_on" {
9898
type = list(any)
9999
default = []
100100
}
101+
102+
variable "create_system_namespace" {
103+
description = "Determines whether the module creates the istio-system namespace."
104+
type = bool
105+
default = true
106+
}

0 commit comments

Comments
 (0)