Skip to content

Commit

Permalink
Refactored AMI filtering for Talos Linux
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Schmid <[email protected]>
  • Loading branch information
PhilipSchmid committed Nov 7, 2023
1 parent fb1d682 commit 4aef106
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions 00-locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion 00-variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 2 additions & 4 deletions 03-talos.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ module "talos" {
| <a name="input_kubernetes_api_allowed_cidr"></a> [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 |
| <a name="input_kubernetes_version"></a> [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 |
| <a name="input_pod_cidr"></a> [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 |
| <a name="input_region"></a> [region](#input\_region) | The region in which to create the RKE2 cluster. | `string` | n/a | yes |
| <a name="input_region"></a> [region](#input\_region) | The region in which to create the Talos Linux cluster. | `string` | n/a | yes |
| <a name="input_service_cidr"></a> [service\_cidr](#input\_service\_cidr) | The CIDR to use for services. | `string` | `"100.68.0.0/16"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | The set of tags to place on the cluster. | `map(string)` | n/a | yes |
| <a name="input_talos_api_allowed_cidr"></a> [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 |
Expand Down

0 comments on commit 4aef106

Please sign in to comment.