getmoto / moto

A library that allows you to easily mock out tests based on AWS infrastructure.
http://docs.getmoto.org/en/latest/
Apache License 2.0
7.59k stars 2.02k forks source link

Autoscaling groups do not pass launch template to EC2 instances. #7979

Closed Skyscimitar closed 1 month ago

Skyscimitar commented 1 month ago

When creating an Auto Scaling Group using moto, the launch template argument is ignored when creating instances in the autoscaling group (only launch config is taken into account). This means that any properties of instances managed by the AutoScaling group and set in the launch template are not transferred to the instance. (In moto.autoscaling.models.FakeAutoScalingGroup.replace_autoscaling_group_instances, we see that only the launch config is used to pass configuration to the created instances and not the launch template).

moto version: 5.0.12 installed using poetry.

bblommers commented 1 month ago

Hi @Skyscimitar, welcome to Moto. We do pass some launch template values, like ImageId, InstanceType, and a few others:

https://github.com/getmoto/moto/blob/fc60bd1c5f6e6184e30a6db8b65059a2855cd28e/moto/autoscaling/models.py#L692

Which other properties would you like to see support for?

Skyscimitar commented 1 month ago

Hello! The tags from the launch_template are the main values we need, for now only the propagated tags of the autoscaling group make their way to the instance.

bblommers commented 1 month ago

Thanks for clarifying @Skyscimitar - I've opened a PR to also send tags through.