mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-18 09:38:33 +01:00
add var 'worker_group_count' to replace 'length()' calls
This commit is contained in:
2
data.tf
2
data.tf
@@ -75,7 +75,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}"
|
||||
|
||||
@@ -74,6 +74,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(
|
||||
@@ -30,7 +30,7 @@ resource "aws_launch_configuration" "workers" {
|
||||
key_name = "${lookup(var.worker_groups[count.index], "key_name", lookup(var.workers_group_defaults, "key_name"))}"
|
||||
user_data_base64 = "${base64encode(element(data.template_file.userdata.*.rendered, count.index))}"
|
||||
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))}"
|
||||
count = "${length(var.worker_groups)}"
|
||||
count = "${var.worker_group_count}"
|
||||
|
||||
lifecycle {
|
||||
create_before_destroy = true
|
||||
|
||||
Reference in New Issue
Block a user