From 3bcf9cc2b6897249066e3ac4fa29188014eb1f31 Mon Sep 17 00:00:00 2001 From: Janis Hahn Date: Sat, 12 Jul 2025 11:13:36 +0200 Subject: [PATCH 1/4] add: add: optional variables in ske --- example/main.tf | 29 ++++++++++++ example/providers.tf | 16 +++++++ example/test.tfvars | 57 +++++++++++++++++++++++ example/variables.tf | 106 +++++++++++++++++++++++++++++++++++++++++++ main.tf | 8 ++-- ske/main.tf | 14 ++++-- ske/variables.tf | 103 ++++++++++++++++++++++++++++++++++++----- 7 files changed, 314 insertions(+), 19 deletions(-) create mode 100644 example/main.tf create mode 100644 example/providers.tf create mode 100644 example/test.tfvars create mode 100644 example/variables.tf diff --git a/example/main.tf b/example/main.tf new file mode 100644 index 0000000..1316f62 --- /dev/null +++ b/example/main.tf @@ -0,0 +1,29 @@ +module "stackit_ske_cluster" { + source = "../ske" # Pfad zu deinem Modul-Ordner + + # Erforderliche Variablen + project_id = var.project_id + name = var.name + node_pools = var.node_pools + + # Optionale Variablen + kubernetes_version_min = var.kubernetes_version_min + allow_privileged_containers = var.allow_privileged_containers + hibernations = var.hibernations + maintenance = var.maintenance + extensions = var.extensions + network = var.network + default_region = var.default_region +} + +/* +module "stackit_ske_cluster" { + source = "../ske" + + project_id = var.project_id + name = var.name + kubernetes_version_min = var.kubernetes_version_min + node_pools = var.node_pools + hibernations = var.hibernations +} +*/ \ No newline at end of file diff --git a/example/providers.tf b/example/providers.tf new file mode 100644 index 0000000..ba2ffb3 --- /dev/null +++ b/example/providers.tf @@ -0,0 +1,16 @@ +terraform { + required_version = ">= 1.9.0" + required_providers { + stackit = { + source = "stackitcloud/stackit" + version = "0.56.0" + } + } +} + +provider "stackit" { + default_region = var.default_region + service_account_key_path = var.service_account_key_path + enable_beta_resources = true +} + diff --git a/example/test.tfvars b/example/test.tfvars new file mode 100644 index 0000000..da28541 --- /dev/null +++ b/example/test.tfvars @@ -0,0 +1,57 @@ + + +node_pools = [ + { + name = "default-pool" + machine_type = "c1.2" + availability_zones = ["eu01-1"] + minimum = 1 + maximum = 2 + cri = "containerd" + volume_type = "storage_premium_perf1" + volume_size = 20 + labels = { + "worker" = "default" + } + taints = [{ + effect = "NoSchedule" + key = "app" + value = "database" + }] + } +] + +kubernetes_version_min = "1.29" + +allow_privileged_containers = false + +hibernations = [ + { + start = "00 18 * * 1-5" # Mo-Fr um 18:00 Uhr + end = "00 08 * * 1-5" # Mo-Fr um 08:00 Uhr + timezone = "Europe/Berlin" + } + ] + +maintenance = { + enable_kubernetes_version_updates = true + enable_machine_image_version_updates = true + start = "01:00:00Z" + end = "03:00:00Z" +} + +extensions = { + acl = { + enabled = true + allowed_cidrs = ["0.0.0.0/0"] + } + argus = { + enabled = true + argus_instance_id = "deine-argus-instanz-id" + } + dns = { + enabled = true + zones = ["example.com"] + } +} + diff --git a/example/variables.tf b/example/variables.tf new file mode 100644 index 0000000..65fc872 --- /dev/null +++ b/example/variables.tf @@ -0,0 +1,106 @@ +variable "project_id" { + description = "STACKIT Cloud project ID" + type = string + default = "6f9528aa-27c8-4e97-a0f7-51bbf3be417c" +} + +variable "service_account_key_path" { + type = string + default = "/home/hahnjan/.stackit/sa.json" +} + +variable "default_region" { + type = string + default = "eu01" +} + +variable "name" { + description = "Ein Präfix für den Namen des SKE-Clusters." + type = string + default = "my-ske-cluster" +} + +variable "node_pools" { + description = "One or more node_pool blocks." + type = list(object({ + name = string + machine_type = string + availability_zones = list(string) + minimum = number + maximum = number + allow_system_components = optional(bool) + cri = optional(string) + labels = optional(map(string)) + max_surge = optional(number) + max_unavailable = optional(number) + os_name = optional(string) + os_version_min = optional(string) + taints = optional(list(object({ + effect = string + key = string + value = optional(string) + }))) + volume_size = optional(number) + volume_type = optional(string) + })) +} + +variable "kubernetes_version_min" { + description = "The minimum Kubernetes version." + type = string + default = null +} + +variable "allow_privileged_containers" { + description = "Flag to specify if privileged mode for containers is enabled or not." + type = bool + default = null +} + +variable "hibernations" { + description = "A list of hibernation schedules for the cluster." + type = list(object({ + start = string + end = string + timezone = optional(string) + })) + default = null +} + +variable "maintenance" { + description = "A single maintenance block." + type = object({ + enable_kubernetes_version_updates = bool + enable_machine_image_version_updates = bool + start = string + end = string + }) + default = null +} + +variable "extensions" { + description = "A single extensions block." + type = object({ + acl = optional(object({ + enabled = bool + allowed_cidrs = list(string) + })) + argus = optional(object({ + enabled = bool + argus_instance_id = string + })) + dns = optional(object({ + enabled = bool + zones = optional(list(string)) + })) + }) + default = null +} + +variable "network" { + description = "Network block." + type = object({ + id = string + }) + default = null +} diff --git a/main.tf b/main.tf index c702464..ecb00bb 100644 --- a/main.tf +++ b/main.tf @@ -10,7 +10,7 @@ terraform { } provider "stackit" { - default_region = var.default_region + default_region = var.default_region service_account_key_path = var.service_account_key_path private_key_path = var.private_key_path enable_beta_resources = true @@ -21,10 +21,12 @@ module "project" { source = "./project" # -- variables for project module - organization_id = var.organization_id - sna_net = var.sna_net + organization_id = var.organization_id + sna_net = var.sna_net } + + diff --git a/ske/main.tf b/ske/main.tf index 90124a0..db7d8ed 100644 --- a/ske/main.tf +++ b/ske/main.tf @@ -1,8 +1,14 @@ resource "stackit_ske_cluster" "this" { - project_id = var.project_id - name = var.name - kubernetes_version_min = var.kubernetes_version_min - node_pools = var.node_pools + project_id = var.project_id + name = var.name + node_pools = var.node_pools + kubernetes_version_min = var.kubernetes_version_min + allow_privileged_containers = var.allow_privileged_containers + hibernations = var.hibernations + maintenance = var.maintenance + extensions = var.extensions + network = var.network + region = var.default_region } resource "stackit_ske_kubeconfig" "admin" { diff --git a/ske/variables.tf b/ske/variables.tf index 53533c0..dd9aa96 100644 --- a/ske/variables.tf +++ b/ske/variables.tf @@ -1,22 +1,101 @@ variable "project_id" { - type = string + description = "STACKIT project ID to which the cluster is associated." + type = string } variable "name" { - type = string -} - -variable "kubernetes_version_min" { - type = string + description = "The cluster name." + type = string } variable "node_pools" { + description = "One or more node_pool blocks." type = list(object({ - name = string - machine_type = string - availability_zones = list(string) - volume_size = number - minimum = number - maximum = number + name = string + machine_type = string + availability_zones = list(string) + minimum = number + maximum = number + allow_system_components = optional(bool) + cri = optional(string) + labels = optional(map(string)) + max_surge = optional(number) + max_unavailable = optional(number) + os_name = optional(string) + os_version_min = optional(string) + taints = optional(list(object({ + effect = string + key = string + value = optional(string) + }))) + volume_size = optional(number) + volume_type = optional(string) })) } + +# -- Optionale Variablen -- +variable "kubernetes_version_min" { + description = "The minimum Kubernetes version." + type = string + default = null +} + +variable "allow_privileged_containers" { + description = "Flag to specify if privileged mode for containers is enabled or not." + type = bool + default = null +} + +variable "hibernations" { + description = "A list of hibernation schedules for the cluster." + type = list(object({ + start = string + end = string + timezone = optional(string) + })) + default = null +} + +variable "maintenance" { + description = "A single maintenance block." + type = object({ + enable_kubernetes_version_updates = bool + enable_machine_image_version_updates = bool + start = string + end = string + }) + default = null +} + +variable "extensions" { + description = "A single extensions block." + type = object({ + acl = optional(object({ + enabled = bool + allowed_cidrs = list(string) + })) + argus = optional(object({ + enabled = bool + argus_instance_id = string + })) + dns = optional(object({ + enabled = bool + zones = optional(list(string)) + })) + }) + default = null +} + +variable "network" { + description = "Network block." + type = object({ + id = string + }) + default = null +} + +variable "default_region" { + description = "The resource region." + type = string + default = null +} \ No newline at end of file From 91fdd1d420c1e0925dacadd31eae0da40c6705e5 Mon Sep 17 00:00:00 2001 From: Janis Hahn Date: Tue, 15 Jul 2025 20:54:48 +0200 Subject: [PATCH 2/4] sna + projects --- example/main.tf | 41 ++++++++++++++++++++++++----------------- example/test.tfvars | 32 +++++++++++++++++++++++++++++--- example/variables.tf | 39 ++++++++++++++++++++++++++++++--------- project/main.tf | 33 +++++---------------------------- project/outputs.tf | 4 ++++ project/sna.tf | 27 --------------------------- project/variables.tf | 10 ++++++++-- ske/main.tf | 1 - ske/variables.tf | 7 ------- 9 files changed, 100 insertions(+), 94 deletions(-) create mode 100644 project/outputs.tf delete mode 100644 project/sna.tf diff --git a/example/main.tf b/example/main.tf index 1316f62..68ee7bb 100644 --- a/example/main.tf +++ b/example/main.tf @@ -1,14 +1,32 @@ -module "stackit_ske_cluster" { - source = "../ske" # Pfad zu deinem Modul-Ordner +resource "stackit_network_area" "project_sna" { + organization_id = var.organization_id + name = var.SNA_name + network_ranges = var.SNA_network_ranges + transfer_network = var.SNA_transfer_network +} - # Erforderliche Variablen - project_id = var.project_id +module "projects" { + source = "../project" + + projects = var.Projects_map + organization_id = var.organization_id + sna_id = stackit_network_area.project_sna.network_area_id +} + +locals { + project_ids = { for k, v in module.projects.created_projects : k => v.project_id } +} + +module "stackit_ske_cluster" { + source = "../ske" + + # required variables + project_id = local.project_ids[var.ske_target_project_key] name = var.name node_pools = var.node_pools - # Optionale Variablen + # optional variables kubernetes_version_min = var.kubernetes_version_min - allow_privileged_containers = var.allow_privileged_containers hibernations = var.hibernations maintenance = var.maintenance extensions = var.extensions @@ -16,14 +34,3 @@ module "stackit_ske_cluster" { default_region = var.default_region } -/* -module "stackit_ske_cluster" { - source = "../ske" - - project_id = var.project_id - name = var.name - kubernetes_version_min = var.kubernetes_version_min - node_pools = var.node_pools - hibernations = var.hibernations -} -*/ \ No newline at end of file diff --git a/example/test.tfvars b/example/test.tfvars index da28541..93a2653 100644 --- a/example/test.tfvars +++ b/example/test.tfvars @@ -1,4 +1,29 @@ +# ------------------ +organization_id = "03a34540-3c1a-4794-b2c6-7111ecf824ef" + +Projects_map = { + "projekt-alpha" = { + name = "tf_modules_test_1" + owner_email = "janis.hahn@stackit.cloud" + }, + "projekt-beta" = { + name = "tf_modules_test_2" + owner_email = "janis.hahn@stackit.cloud" + } +} + +SNA_name = "sna-tf_modules_test" + +SNA_network_ranges = [ + { prefix = "192.168.10.0/24" } +] + +SNA_transfer_network = "172.16.0.0/24" + +name = "cluster" + +ske_target_project_key = "projekt-alpha" # projekt-alpha or projekt-beta ... or other from above to ensure scalability node_pools = [ { @@ -21,9 +46,7 @@ node_pools = [ } ] -kubernetes_version_min = "1.29" - -allow_privileged_containers = false +kubernetes_version_min = "1.32.5" hibernations = [ { @@ -55,3 +78,6 @@ extensions = { } } +network = { + id = "bae113a7-cc47-4b1e-8abd-3cdacdd53f28" +} diff --git a/example/variables.tf b/example/variables.tf index 65fc872..2e45481 100644 --- a/example/variables.tf +++ b/example/variables.tf @@ -1,9 +1,10 @@ -variable "project_id" { - description = "STACKIT Cloud project ID" +# SNA & Projects variables +variable "organization_id" { + description = "Die Container-ID deiner STACKIT Organisation." type = string - default = "6f9528aa-27c8-4e97-a0f7-51bbf3be417c" } +variable "ske_target_project_key" { type = string } variable "service_account_key_path" { type = string default = "/home/hahnjan/.stackit/sa.json" @@ -14,6 +15,32 @@ variable "default_region" { default = "eu01" } +variable "SNA_name" { + description = "Name der zu erstellenden Service Network Area." + type = string +} + +variable "SNA_network_ranges" { + description = "Liste der Netzwerk-CIDRs für die SNA." + type = list(object({ prefix = string })) +} + +variable "SNA_transfer_network" { + description = "Das Transfer-Netzwerk für die SNA (z.B. 172.16.9.0/24)." + type = string +} + +variable "Projects_map" { + description = "Eine Map von Projekten, die erstellt werden sollen." + type = map(object({ + name = string + owner_email = string + })) +} + + +# SKE variables + variable "name" { description = "Ein Präfix für den Namen des SKE-Clusters." type = string @@ -51,12 +78,6 @@ variable "kubernetes_version_min" { default = null } -variable "allow_privileged_containers" { - description = "Flag to specify if privileged mode for containers is enabled or not." - type = bool - default = null -} - variable "hibernations" { description = "A list of hibernation schedules for the cluster." type = list(object({ diff --git a/project/main.tf b/project/main.tf index 58176f0..b975d4d 100644 --- a/project/main.tf +++ b/project/main.tf @@ -1,34 +1,11 @@ -variable "projects" { - type = map(object({ - name = string - owner_email = string - })) - default = { - project1 = { - name = "project-alpha" - owner_email = "michael.sodan@stackit.cloud" - } - project2 = { - name = "project-beta" - owner_email = "michael.sodan@stackit.cloud" - } - } -} +resource "stackit_resourcemanager_project" "project" { + for_each = var.projects -resource "stackit_resourcemanager_project" "projects" { - for_each = var.projects - parent_container_id = var.organization_id # Nutzt jetzt die übergebene Variable + parent_container_id = var.organization_id name = each.value.name owner_email = each.value.owner_email - # labels = { ... } # Vorerst entfernt, da stackit_network_area nicht definiert war -} -output "project_info" { - value = { - for k, project in stackit_resourcemanager_project.projects : k => { - project_id = project.project_id - container_id = project.container_id - } + labels = { + "networkArea" = var.sna_id } } - diff --git a/project/outputs.tf b/project/outputs.tf new file mode 100644 index 0000000..6aac267 --- /dev/null +++ b/project/outputs.tf @@ -0,0 +1,4 @@ +output "created_projects" { + description = "Eine Map aller erstellten STACKIT Projekte." + value = stackit_resourcemanager_project.project +} \ No newline at end of file diff --git a/project/sna.tf b/project/sna.tf deleted file mode 100644 index 711c80d..0000000 --- a/project/sna.tf +++ /dev/null @@ -1,27 +0,0 @@ -/* resource "time_sleep" "wait_before_destroy" { - destroy_duration = "60s" -} -*/ - -resource "stackit_network_area" "sna" { - organization_id = var.organization_id - name = "bego_sna" - network_ranges = [ - { - prefix = "10.220.0.0/16" - } - ] - transfer_network = "var.sna_net" - //depends_on = [time_sleep.wait_before_destroy] -} - -/* resource "stackit_network_area_route" "sna_route1" { - organization_id = var.organization_id - network_area_id = stackit_network_area.sna.network_area_id - prefix = "10.220.99.0/24" - next_hop = "10.220.0.0" - labels = { - "key" = "value" - } -} -*/ diff --git a/project/variables.tf b/project/variables.tf index 6a8400f..6ff8c04 100644 --- a/project/variables.tf +++ b/project/variables.tf @@ -2,9 +2,15 @@ variable "organization_id" { description = "Empfängt die Container-ID der Organisation vom Root-Modul." type = string } +variable "projects" { + type = map(object({ + name = string + owner_email = string + })) +} -variable "sna_net" { - description = "SNA Transfer Network" +variable "sna_id" { + description = "Empfängt die ID der Network Area vom Root-Modul." type = string } diff --git a/ske/main.tf b/ske/main.tf index db7d8ed..1cda6b9 100644 --- a/ske/main.tf +++ b/ske/main.tf @@ -3,7 +3,6 @@ resource "stackit_ske_cluster" "this" { name = var.name node_pools = var.node_pools kubernetes_version_min = var.kubernetes_version_min - allow_privileged_containers = var.allow_privileged_containers hibernations = var.hibernations maintenance = var.maintenance extensions = var.extensions diff --git a/ske/variables.tf b/ske/variables.tf index dd9aa96..2f70fc6 100644 --- a/ske/variables.tf +++ b/ske/variables.tf @@ -40,12 +40,6 @@ variable "kubernetes_version_min" { default = null } -variable "allow_privileged_containers" { - description = "Flag to specify if privileged mode for containers is enabled or not." - type = bool - default = null -} - variable "hibernations" { description = "A list of hibernation schedules for the cluster." type = list(object({ @@ -66,7 +60,6 @@ variable "maintenance" { }) default = null } - variable "extensions" { description = "A single extensions block." type = object({ From f43585ca95247680f19b86165fe42a0bacac60ee Mon Sep 17 00:00:00 2001 From: Janis Hahn Date: Tue, 15 Jul 2025 22:30:05 +0200 Subject: [PATCH 3/4] SKE loop --- example/main.tf | 26 ++++----- example/test.tfvars | 116 ++++++++++++++++++++----------------- example/variables.tf | 134 +++++++++++++++++-------------------------- ske/variables.tf | 2 +- 4 files changed, 129 insertions(+), 149 deletions(-) diff --git a/example/main.tf b/example/main.tf index 68ee7bb..6d42b65 100644 --- a/example/main.tf +++ b/example/main.tf @@ -18,19 +18,19 @@ locals { } module "stackit_ske_cluster" { - source = "../ske" + for_each = var.ske_clusters + source = "../ske" + project_id = local.project_ids[each.value.project_key] + name = each.value.name + node_pools = each.value.node_pools + network = { + id = each.value.network_id + } - # required variables - project_id = local.project_ids[var.ske_target_project_key] - name = var.name - node_pools = var.node_pools - - # optional variables - kubernetes_version_min = var.kubernetes_version_min - hibernations = var.hibernations - maintenance = var.maintenance - extensions = var.extensions - network = var.network - default_region = var.default_region + kubernetes_version_min = lookup(each.value, "kubernetes_version_min", null) + hibernations = lookup(each.value, "hibernations", null) + maintenance = lookup(each.value, "maintenance", null) + extensions = lookup(each.value, "extensions", null) + default_region = var.default_region } diff --git a/example/test.tfvars b/example/test.tfvars index 93a2653..128f2eb 100644 --- a/example/test.tfvars +++ b/example/test.tfvars @@ -4,11 +4,11 @@ organization_id = "03a34540-3c1a-4794-b2c6-7111ecf824ef" Projects_map = { "projekt-alpha" = { - name = "tf_modules_test_1" + name = "tf_modules_test_3" owner_email = "janis.hahn@stackit.cloud" }, "projekt-beta" = { - name = "tf_modules_test_2" + name = "tf_modules_test_4" owner_email = "janis.hahn@stackit.cloud" } } @@ -21,63 +21,71 @@ SNA_network_ranges = [ SNA_transfer_network = "172.16.0.0/24" -name = "cluster" +ske_clusters = { -ske_target_project_key = "projekt-alpha" # projekt-alpha or projekt-beta ... or other from above to ensure scalability + "prod-cluster" = { + name = "clusterprod" + project_key = "projekt-alpha" + network_id = "53917a75-0014-49b0-a4d6-e62934ab479f" # WICHTIG: Hier die Netzwerk-ID connecten + kubernetes_version_min = "1.32.5" -node_pools = [ - { - name = "default-pool" - machine_type = "c1.2" - availability_zones = ["eu01-1"] - minimum = 1 - maximum = 2 - cri = "containerd" - volume_type = "storage_premium_perf1" - volume_size = 20 - labels = { - "worker" = "default" + node_pools = [ + { + name = "defaulpool" + machine_type = "c1.2" + availability_zones = ["eu01-1"] + minimum = 1 + maximum = 2 + cri = "containerd" + volume_type = "storage_premium_perf1" + volume_size = 21 + labels = { "worker" = "default" } + taints = [{ + effect = "NoSchedule" + key = "app" + value = "database" + }] + } + ] + + hibernations = [ + { + start = "00 18 * * 1-5" # Mo-Fr um 18:00 Uhr + end = "00 08 * * 1-5" # Mo-Fr um 08:00 Uhr + timezone = "Europe/Berlin" + } + ] + + maintenance = { + enable_kubernetes_version_updates = true + enable_machine_image_version_updates = true + start = "01:00:00Z" + end = "03:00:00Z" } - taints = [{ - effect = "NoSchedule" - key = "app" - value = "database" - }] - } -] -kubernetes_version_min = "1.32.5" + extensions = { + acl = { + enabled = true + allowed_cidrs = ["0.0.0.0/0"] + } + } + }, -hibernations = [ - { - start = "00 18 * * 1-5" # Mo-Fr um 18:00 Uhr - end = "00 08 * * 1-5" # Mo-Fr um 08:00 Uhr - timezone = "Europe/Berlin" - } - ] + "dev-cluster" = { + name = "clusterdev" + kubernetes_version_min = "1.32.5" + project_key = "projekt-beta" + network_id = "9c3dea6a-2971-414e-8c06-04618aa2c1f7" # WICHTIG: Hier die Netzwerk-ID connecten -maintenance = { - enable_kubernetes_version_updates = true - enable_machine_image_version_updates = true - start = "01:00:00Z" - end = "03:00:00Z" -} - -extensions = { - acl = { - enabled = true - allowed_cidrs = ["0.0.0.0/0"] - } - argus = { - enabled = true - argus_instance_id = "deine-argus-instanz-id" - } - dns = { - enabled = true - zones = ["example.com"] + node_pools = [ + { + name = "devpool" + machine_type = "c1.2" + availability_zones = ["eu01-2"] + minimum = 1 + maximum = 1 + volume_size = 21 + } + ] } } - -network = { - id = "bae113a7-cc47-4b1e-8abd-3cdacdd53f28" -} diff --git a/example/variables.tf b/example/variables.tf index 2e45481..f2077bb 100644 --- a/example/variables.tf +++ b/example/variables.tf @@ -4,7 +4,6 @@ variable "organization_id" { type = string } -variable "ske_target_project_key" { type = string } variable "service_account_key_path" { type = string default = "/home/hahnjan/.stackit/sa.json" @@ -41,87 +40,60 @@ variable "Projects_map" { # SKE variables -variable "name" { - description = "Ein Präfix für den Namen des SKE-Clusters." - type = string - default = "my-ske-cluster" -} +variable "ske_clusters" { + description = "Eine Map von SKE-Clustern" + type = map(object({ -variable "node_pools" { - description = "One or more node_pool blocks." - type = list(object({ - name = string - machine_type = string - availability_zones = list(string) - minimum = number - maximum = number - allow_system_components = optional(bool) - cri = optional(string) - labels = optional(map(string)) - max_surge = optional(number) - max_unavailable = optional(number) - os_name = optional(string) - os_version_min = optional(string) - taints = optional(list(object({ - effect = string - key = string - value = optional(string) + name = string + project_key = string + network_id = string + + kubernetes_version_min = optional(string) + hibernations = optional(list(object({ + start = string + end = string + timezone = optional(string) }))) - volume_size = optional(number) - volume_type = optional(string) + maintenance = optional(object({ + enable_kubernetes_version_updates = bool + enable_machine_image_version_updates = bool + start = string + end = string + })) + extensions = optional(object({ + acl = optional(object({ + enabled = bool + allowed_cidrs = list(string) + })) + argus = optional(object({ + enabled = bool + argus_instance_id = string + })) + })) + + node_pools = list(object({ + + name = string + machine_type = string + availability_zones = list(string) + minimum = number + maximum = number + + allow_system_components = optional(bool) + cri = optional(string) + labels = optional(map(string)) + max_surge = optional(number) + max_unavailable = optional(number) + os_name = optional(string) + os_version_min = optional(string) + volume_size = optional(number) + volume_type = optional(string) + taints = optional(list(object({ + effect = string + key = string + value = optional(string) + }))) + })) })) -} - -variable "kubernetes_version_min" { - description = "The minimum Kubernetes version." - type = string - default = null -} - -variable "hibernations" { - description = "A list of hibernation schedules for the cluster." - type = list(object({ - start = string - end = string - timezone = optional(string) - })) - default = null -} - -variable "maintenance" { - description = "A single maintenance block." - type = object({ - enable_kubernetes_version_updates = bool - enable_machine_image_version_updates = bool - start = string - end = string - }) - default = null -} - -variable "extensions" { - description = "A single extensions block." - type = object({ - acl = optional(object({ - enabled = bool - allowed_cidrs = list(string) - })) - argus = optional(object({ - enabled = bool - argus_instance_id = string - })) - dns = optional(object({ - enabled = bool - zones = optional(list(string)) - })) - }) - default = null -} - -variable "network" { - description = "Network block." - type = object({ - id = string - }) - default = null + default = {} } diff --git a/ske/variables.tf b/ske/variables.tf index 2f70fc6..ccae10c 100644 --- a/ske/variables.tf +++ b/ske/variables.tf @@ -33,7 +33,7 @@ variable "node_pools" { })) } -# -- Optionale Variablen -- +# Optionale Variablen variable "kubernetes_version_min" { description = "The minimum Kubernetes version." type = string From d866284e1f6eff99c44481106f0cdc6fe111bc66 Mon Sep 17 00:00:00 2001 From: Janis Hahn Date: Wed, 16 Jul 2025 12:55:50 +0200 Subject: [PATCH 4/4] update SKE --- .gitignore | 1 + example/test.tfvars | 8 +++----- example/variables.tf | 1 + project/variables.tf | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5dfe310..278cec6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .terraform* terraform.tfstate* +kubeconfig-clusterdev.yaml \ No newline at end of file diff --git a/example/test.tfvars b/example/test.tfvars index 128f2eb..b0d5467 100644 --- a/example/test.tfvars +++ b/example/test.tfvars @@ -1,5 +1,3 @@ -# ------------------ - organization_id = "03a34540-3c1a-4794-b2c6-7111ecf824ef" Projects_map = { @@ -70,12 +68,12 @@ ske_clusters = { } } }, - + "dev-cluster" = { name = "clusterdev" kubernetes_version_min = "1.32.5" project_key = "projekt-beta" - network_id = "9c3dea6a-2971-414e-8c06-04618aa2c1f7" # WICHTIG: Hier die Netzwerk-ID connecten + network_id = "bedfc709-9285-4078-93ab-8e8a1c0be6bd" # WICHTIG: Hier die Netzwerk-ID connecten node_pools = [ { @@ -83,7 +81,7 @@ ske_clusters = { machine_type = "c1.2" availability_zones = ["eu01-2"] minimum = 1 - maximum = 1 + maximum = 2 volume_size = 21 } ] diff --git a/example/variables.tf b/example/variables.tf index f2077bb..3665f68 100644 --- a/example/variables.tf +++ b/example/variables.tf @@ -1,4 +1,5 @@ # SNA & Projects variables + variable "organization_id" { description = "Die Container-ID deiner STACKIT Organisation." type = string diff --git a/project/variables.tf b/project/variables.tf index 6ff8c04..d2419f8 100644 --- a/project/variables.tf +++ b/project/variables.tf @@ -2,6 +2,7 @@ variable "organization_id" { description = "Empfängt die Container-ID der Organisation vom Root-Modul." type = string } + variable "projects" { type = map(object({ name = string