diff --git a/terraform/modules/aws/node_group/README.md b/terraform/modules/aws/node_group/README.md index 03b17bcdb..324537bc1 100644 --- a/terraform/modules/aws/node_group/README.md +++ b/terraform/modules/aws/node_group/README.md @@ -38,6 +38,7 @@ to use with Application Load Balancers with the `instance_target_group_arns` var | instance_security_group_ids | List of security group ids to attach to the ASG | list | - | yes | | instance_subnet_ids | List of subnet ids where the instance can be deployed | list | - | yes | | instance_target_group_arns | The ARN of the target group with which to register targets. | list | `` | no | +| instance_target_group_arns_length | Length of instance_target_group_arns | string | `0` | no | | instance_type | Instance type | string | `t2.micro` | no | | instance_user_data | User_data provisioning script (default user_data.sh in module directory) | string | `user_data.sh` | no | | name | Jumpbox resources name. Only alphanumeric characters and hyphens allowed | string | - | yes | diff --git a/terraform/modules/aws/node_group/main.tf b/terraform/modules/aws/node_group/main.tf index ed98c53dc..ec2f3edd7 100644 --- a/terraform/modules/aws/node_group/main.tf +++ b/terraform/modules/aws/node_group/main.tf @@ -102,6 +102,12 @@ variable "instance_target_group_arns" { default = [] } +variable "instance_target_group_arns_length" { + type = "string" + description = "Length of instance_target_group_arns" + default = 0 +} + variable "asg_desired_capacity" { type = "string" description = "The autoscaling groups desired capacity" @@ -282,7 +288,7 @@ resource "aws_autoscaling_group" "node_autoscaling_group" { } resource "aws_autoscaling_attachment" "node_autoscaling_group_attachment_alb" { - count = "${length(var.instance_target_group_arns)}" + count = "${var.instance_target_group_arns_length}" autoscaling_group_name = "${aws_autoscaling_group.node_autoscaling_group.id}" alb_target_group_arn = "${element(var.instance_target_group_arns, count.index)}" }