terraform-aws-modules / terraform-aws-autoscaling

Terraform module to create AWS Auto Scaling resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/autoscaling/aws
Apache License 2.0
292 stars 556 forks source link

use custom name (based on tags + ec2 id) for every ec2 in an asg #144

Closed ashraf133 closed 3 years ago

ashraf133 commented 3 years ago

Hello,

It would be nice to have the ability to give a unique name for every ec2 instance in an asg, actually the module give to all ec2 instances the same name as the asg name

It could be something like ${project_name_tag}+i-124123434124

bryantbiggs commented 3 years ago

hi @ashraf133 I don't think this is possible. you can give a name just to the instance using something like https://github.com/terraform-aws-modules/terraform-aws-autoscaling/blob/c9510239bf35fe6acb87b25fa8a56b4ba31554d7/examples/complete/main.tf#L494 but the autoscaling group is just a service that stamps out instances - there really isn't a way to tell the ASG to create a unique name unless you do something custom with a lambda and eventbridge (checking for instance launch events)

github-actions[bot] commented 1 year ago

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.