Terraform-aws-eks: Use "null" Target Group ARNs instead of empty list

Created on 9 Sep 2019  路  1Comment  路  Source: terraform-aws-modules/terraform-aws-eks

We encountered an issue caused by the argument target_group_arns of the created Autoscaling Group to default to an empty list:

https://github.com/terraform-aws-modules/terraform-aws-eks/blob/97df53c0994d62f924133e2b5fd0bb67e5f7b11b/local.tf#L47

We wanted to use aws_autoscaling_attachment resources to add target groups in a different configuration. However, with the default being an empty list, Terraform believes that we want to exclusively manage the Target Groups in the Autoscaling Group resource, and will try to remove all attached target groups.

This is in line with the documentation:

NOTE on AutoScaling Groups and ASG Attachments: Terraform currently provides both a standalone ASG Attachment resource (describing an ASG attached to an ELB), and an AutoScaling Group resource with load_balancers defined in-line. At this time you cannot use an ASG with in-line load balancers in conjunction with an ASG Attachment resource. Doing so will cause a conflict and will overwrite attachments.

We were surprised by this as we did not specify any Target Group ARNs when instantiating the EKS module. While the autoscaling group defaults to "not specified", the EKS module defaults to "an intentionally left empty" in-line configuration.

We found that setting the default of target_group_arns to null fixes this issue, as it is apparently interpreted as "not specified".

Arguably, this could also be considered a bug in the AWS provider, as it is unclear from the documentation what to set target_group_arns to if you want to use the attachment resource instead.

Most helpful comment

Bumped into this too and like @ferdinand-beyer said, workaround for this is to pass following variable to the module:

workers_group_defaults = {
    target_group_arns = null
}

However, I created PR to change null as the default value.

>All comments

Bumped into this too and like @ferdinand-beyer said, workaround for this is to pass following variable to the module:

workers_group_defaults = {
    target_group_arns = null
}

However, I created PR to change null as the default value.

Was this page helpful?
0 / 5 - 0 ratings