pass lifecycle configuration to autoscaling group
Closed this issue · 4 comments
Is your request related to a new offering from AWS?
Is this functionality available in the AWS provider for Terraform? - Yes ✅: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group
Is your request related to a problem? Please describe.
I'm using the eks module to create a cluster with a self_managed_node_group.
Later on I create a network load balancer using terraform and try to attach the automatically created autoscaling group from the eks module to the load balancer using the https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_attachment.
The aws provider documentation explains that it is necessary to add lifecycle ignore_changes arguments for the autoscaling group if you are using the autoscaling_attachment (see hint on https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group).
NOTE on Auto Scaling Groups and ASG Attachments:
Terraform currently provides both a standalone aws_autoscaling_attachment resource (describing an ASG attached to an ELB or ALB), and an aws_autoscaling_group with load_balancers and target_group_arns defined in-line. These two methods are not mutually-exclusive. If aws_autoscaling_attachment resources are used, either alone or with inline load_balancers or target_group_arns, the aws_autoscaling_group resource must be configured to ignore changes to the load_balancers and target_group_arns arguments within a lifecycle configuration block.
Looking at the module code in
I can see that it's currently not possible to configure the lifecycle of the autoscaling_group created by the module.Describe the solution you'd like.
I would like to pass the lifecycle configuration for the autoscaling group through the self_managed_node_group configuration.
Describe alternatives you've considered.
I've considered to create the autoscaling group myself but don't know exactly how to connect or replicate the behaviour created by the eks module (and I would like to avoid this because it's one of the benefits of using this module).
Additional context
My autoscaling attachment currently looks like this:
resource "aws_autoscaling_attachment" "target-group-attachement" {
for_each = module.eks.self_managed_node_groups
autoscaling_group_name = each.value.autoscaling_group_name
lb_target_group_arn = aws_lb_target_group.extern.arn
}
If you need more information or there's a better way of solving my issue, please let me know.
unfortunately this is not supported by Terraform core at this time hashicorp/terraform#27360
Thanks for the answer, guess I will have to manage the autoscaling group myself then.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.