From 4aef106c245de19ff71ad9754f6e235b32d239dc Mon Sep 17 00:00:00 2001 From: Philip Schmid Date: Fri, 3 Nov 2023 17:36:03 +0100 Subject: [PATCH] Refactored AMI filtering for Talos Linux Signed-off-by: Philip Schmid --- 00-locals.tf | 2 -- 00-variables.tf | 2 +- 03-talos.tf | 6 ++---- README.md | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/00-locals.tf b/00-locals.tf index 64f0645..bdaf9c0 100644 --- a/00-locals.tf +++ b/00-locals.tf @@ -13,8 +13,6 @@ resource "random_string" "workspace_id" { locals { - ami_id = data.aws_ami.talos.id - path_to_workspace_dir = "${abspath(path.root)}/.terraform/.workspace-${random_string.workspace_id.id}" path_to_kubeconfig_file = "${local.path_to_workspace_dir}/kubeconfig" path_to_talosconfig_file = "${local.path_to_workspace_dir}/talosconfig" diff --git a/00-variables.tf b/00-variables.tf index fadee47..691779c 100644 --- a/00-variables.tf +++ b/00-variables.tf @@ -10,7 +10,7 @@ variable "cluster_id" { } variable "region" { - description = "The region in which to create the RKE2 cluster." + description = "The region in which to create the Talos Linux cluster." type = string } diff --git a/03-talos.tf b/03-talos.tf index b98f458..b8c468e 100644 --- a/03-talos.tf +++ b/03-talos.tf @@ -5,8 +5,7 @@ module "talos_control_plane_nodes" { count = var.controlplane_count name = "${var.cluster_name}-control-plane-${count.index}" - ami = local.ami_id - monitoring = true + ami = data.aws_ami.talos.id instance_type = var.control_plane.instance_type subnet_id = element(data.aws_subnets.public.ids, count.index) associate_public_ip_address = true @@ -28,8 +27,7 @@ module "talos_worker_group" { for_each = merge([for info in var.worker_groups : { for index in range(0, var.workers_count) : "${info.name}.${index}" => info }]...) name = "${var.cluster_name}-worker-group-${each.value.name}-${trimprefix(each.key, "${each.value.name}.")}" - ami = local.ami_id - monitoring = true + ami = data.aws_ami.talos.id instance_type = each.value.instance_type subnet_id = element(data.aws_subnets.public.ids, tonumber(trimprefix(each.key, "${each.value.name}."))) associate_public_ip_address = true diff --git a/README.md b/README.md index 39f7df3..eff4d57 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ module "talos" { | [kubernetes\_api\_allowed\_cidr](#input\_kubernetes\_api\_allowed\_cidr) | The CIDR from which to allow to access the Kubernetes API | `string` | `"0.0.0.0/0"` | no | | [kubernetes\_version](#input\_kubernetes\_version) | Kubernetes version to use for the Talos cluster, if not set, the K8s version shipped with the selected Talos version will be used. Check https://www.talos.dev/v1.5/introduction/support-matrix/. For example '1.27.3'. | `string` | `""` | no | | [pod\_cidr](#input\_pod\_cidr) | The CIDR to use for Pods. Only required in case allocate\_node\_cidrs is set to 'true'. Otherwise, simply configure it inside Cilium's Helm values. | `string` | `"100.64.0.0/14"` | no | -| [region](#input\_region) | The region in which to create the RKE2 cluster. | `string` | n/a | yes | +| [region](#input\_region) | The region in which to create the Talos Linux cluster. | `string` | n/a | yes | | [service\_cidr](#input\_service\_cidr) | The CIDR to use for services. | `string` | `"100.68.0.0/16"` | no | | [tags](#input\_tags) | The set of tags to place on the cluster. | `map(string)` | n/a | yes | | [talos\_api\_allowed\_cidr](#input\_talos\_api\_allowed\_cidr) | The CIDR from which to allow to access the Talos API | `string` | `"0.0.0.0/0"` | no |