mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-18 17:47:31 +01:00
reverting calculation of count for worker groups
This commit is contained in:
@@ -113,6 +113,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
|
||||
| subnets | A list of subnets to place the EKS cluster and workers within. | list | - | yes |
|
||||
| tags | A map of tags to add to all resources. | map | `<map>` | no |
|
||||
| vpc_id | VPC where the cluster and workers will be deployed. | string | - | yes |
|
||||
| worker_group_count | The number of maps contained within the worker_groups list. | string | `1` | no |
|
||||
| worker_groups | A list of maps defining worker group configurations. See workers_group_defaults for valid keys. | list | `<list>` | no |
|
||||
| worker_security_group_id | If provided, all workers will be attached to this security group. If not given, a security group will be created with necessary ingres/egress to work with the EKS cluster. | string | `` | no |
|
||||
| worker_sg_ingress_from_port | Minimum port number from which pods will accept communication. Must be changed to a lower value if some pods in your cluster will expose a port lower than 1025 (e.g. 22, 80, or 443). | string | `1025` | no |
|
||||
|
||||
2
data.tf
2
data.tf
@@ -71,7 +71,7 @@ EOF
|
||||
|
||||
data "template_file" "userdata" {
|
||||
template = "${file("${path.module}/templates/userdata.sh.tpl")}"
|
||||
count = "${length(var.worker_groups)}"
|
||||
count = "${var.worker_group_count}"
|
||||
|
||||
vars {
|
||||
region = "${data.aws_region.current.name}"
|
||||
|
||||
@@ -69,6 +69,12 @@ variable "worker_groups" {
|
||||
}]
|
||||
}
|
||||
|
||||
variable "worker_group_count" {
|
||||
description = "The number of maps contained within the worker_groups list."
|
||||
type = "string"
|
||||
default = "1"
|
||||
}
|
||||
|
||||
variable "workers_group_defaults" {
|
||||
description = "Default values for target groups as defined by the list of maps."
|
||||
type = "map"
|
||||
|
||||
@@ -5,7 +5,7 @@ resource "aws_autoscaling_group" "workers" {
|
||||
min_size = "${lookup(var.worker_groups[count.index], "asg_min_size",lookup(var.workers_group_defaults, "asg_min_size"))}"
|
||||
launch_configuration = "${element(aws_launch_configuration.workers.*.id, count.index)}"
|
||||
vpc_zone_identifier = ["${split(",", coalesce(lookup(var.worker_groups[count.index], "subnets", ""), join(",", var.subnets)))}"]
|
||||
count = "${length(var.worker_groups)}"
|
||||
count = "${var.worker_group_count}"
|
||||
|
||||
tags = ["${concat(
|
||||
list(
|
||||
@@ -33,7 +33,7 @@ resource "aws_launch_configuration" "workers" {
|
||||
ebs_optimized = "${lookup(var.worker_groups[count.index], "ebs_optimized", lookup(local.ebs_optimized, lookup(var.worker_groups[count.index], "instance_type", lookup(var.workers_group_defaults, "instance_type")), false))}"
|
||||
enable_monitoring = "${lookup(var.worker_groups[count.index], "enable_monitoring", lookup(var.workers_group_defaults, "enable_monitoring"))}"
|
||||
spot_price = "${lookup(var.worker_groups[count.index], "spot_price", lookup(var.workers_group_defaults, "spot_price"))}"
|
||||
count = "${length(var.worker_groups)}"
|
||||
count = "${var.worker_group_count}"
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
|
||||
Reference in New Issue
Block a user