Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed per node role AMI config #15

Merged
merged 2 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions 00-variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,10 @@ variable "control_plane" {
description = "Info for control plane that will be created"
type = object({
instance_type = optional(string, "m5.large")
ami_id = optional(string, null)
config_patch_files = optional(list(string), [])
tags = optional(map(string), {})
})

validation {
condition = var.control_plane.ami_id != null ? (length(var.control_plane.ami_id) > 4 && substr(var.control_plane.ami_id, 0, 4) == "ami-") : true
error_message = "The ami_id value must be a valid AMI id, starting with \"ami-\"."
}

default = {}
}

Expand All @@ -106,21 +100,10 @@ variable "worker_groups" {
type = list(object({
name = string
instance_type = optional(string, "m5.large")
ami_id = optional(string, null)
config_patch_files = optional(list(string), [])
tags = optional(map(string), {})
}))

validation {
condition = (
alltrue([
for wg in var.worker_groups : (
wg.ami_id != null ? (length(wg.ami_id) > 4 && substr(wg.ami_id, 0, 4) == "ami-") : true
)
])
)
error_message = "The ami_id value must be a valid AMI id, starting with \"ami-\"."
}
default = [{
name = "default"
}]
Expand Down
4 changes: 2 additions & 2 deletions 03-talos.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module "talos_control_plane_nodes" {
count = var.controlplane_count

name = "${var.cluster_name}-control-plane-${count.index}"
ami = var.control_plane.ami_id == null ? data.aws_ami.talos.id : var.control_plane.ami_id
ami = data.aws_ami.talos.id
monitoring = true
instance_type = var.control_plane.instance_type
subnet_id = element(data.aws_subnets.public.ids, count.index)
Expand All @@ -28,7 +28,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 = each.value.ami_id == null ? data.aws_ami.talos.id : each.value.ami_id
ami = data.aws_ami.talos.id
monitoring = true
instance_type = each.value.instance_type
subnet_id = element(data.aws_subnets.public.ids, tonumber(trimprefix(each.key, "${each.value.name}.")))
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module "talos" {
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | The ID of the cluster. | `number` | `"1"` | no |
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of cluster | `string` | n/a | yes |
| <a name="input_config_patch_files"></a> [config\_patch\_files](#input\_config\_patch\_files) | Path to talos config path files that applies to all nodes | `list(string)` | `[]` | no |
| <a name="input_control_plane"></a> [control\_plane](#input\_control\_plane) | Info for control plane that will be created | <pre>object({<br> instance_type = optional(string, "m5.large")<br> ami_id = optional(string, null)<br> config_patch_files = optional(list(string), [])<br> tags = optional(map(string), {})<br> })</pre> | `{}` | no |
| <a name="input_control_plane"></a> [control\_plane](#input\_control\_plane) | Info for control plane that will be created | <pre>object({<br> instance_type = optional(string, "m5.large")<br> config_patch_files = optional(list(string), [])<br> tags = optional(map(string), {})<br> })</pre> | `{}` | no |
| <a name="input_controlplane_count"></a> [controlplane\_count](#input\_controlplane\_count) | Defines how many controlplane nodes are deployed in the cluster. | `number` | `3` | no |
| <a name="input_disable_kube_proxy"></a> [disable\_kube\_proxy](#input\_disable\_kube\_proxy) | Whether to deploy Kube-Proxy or not. By default, KP shouldn't be deployed. | `bool` | `true` | no |
| <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 |
Expand All @@ -109,7 +109,7 @@ module "talos" {
| <a name="input_talos_version"></a> [talos\_version](#input\_talos\_version) | Talos version to use for the cluster, if not set, the newest Talos version. Check https://github.com/siderolabs/talos/releases for available releases. | `string` | `"v1.5.3"` | no |
| <a name="input_vpc_cidr"></a> [vpc\_cidr](#input\_vpc\_cidr) | The IPv4 CIDR block for the VPC. | `string` | `"10.0.0.0/16"` | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | ID of the VPC where to place the VMs. | `string` | n/a | yes |
| <a name="input_worker_groups"></a> [worker\_groups](#input\_worker\_groups) | List of node worker node groups to create | <pre>list(object({<br> name = string<br> instance_type = optional(string, "m5.large")<br> ami_id = optional(string, null)<br> config_patch_files = optional(list(string), [])<br> tags = optional(map(string), {})<br> }))</pre> | <pre>[<br> {<br> "name": "default"<br> }<br>]</pre> | no |
| <a name="input_worker_groups"></a> [worker\_groups](#input\_worker\_groups) | List of node worker node groups to create | <pre>list(object({<br> name = string<br> instance_type = optional(string, "m5.large")<br> config_patch_files = optional(list(string), [])<br> tags = optional(map(string), {})<br> }))</pre> | <pre>[<br> {<br> "name": "default"<br> }<br>]</pre> | no |
| <a name="input_workers_count"></a> [workers\_count](#input\_workers\_count) | Defines how many worker nodes are deployed in the cluster. | `number` | `2` | no |

### Outputs
Expand Down