I've got an auto-scaling group set up in a pulumi ...
# aws
b
I've got an auto-scaling group set up in a pulumi template that also uses a launch configuration in the same template. when i update the launch configuration (eg when the AMI needs to change), it does trigger a subsequent update in the autoscaling group however the instances in that group don't change. i imagine this is due to the underlying terraform provider not supporting it (there's an open issue to resolve it byt triggering an instance refresh). what would be the best way to work around this in Pulumi? basically i want to trigger a new instance refresh whenever the launch configuration changes.
for some more context, in CloudFormation, any update to the
AWS::AutoScaling::AutoScalingGroup
resource also orchestrates an instance refresh and waits until it completes (or times out). https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html
b
this isn't exposed as an API option, rolling updates are only supported in CloudFormation. You can work around it by defining a cloudformation template in pulumi
s
The default behavior of just updating a Launch Configuration is that any new instance will use the new launch config. There isn't an instance replacement ever since only the config is updated. I think @billowy-army-68599 is correct in that you would need to use pulumi to automate cloudformation instead if you want that behavior.
b
the instance refresh action is an api endpoint (https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_StartInstanceRefresh.html) but i understand the support for it isn't quite there yet. what i was hoping to get is some suggestions on how I could orchestrate this myself via Pulumi. defining a cloudformation template in pulumi is one option i hadn't considered, so thanks, i'll have a think about that. what I was hoping to try and do is programatically within a template be able to identify if the launch configuration has changed, and if so fire off an instance refresh API call. i assume this might be something doable with
pulumi.dynamic.ResourceProvider
perhaps but i don't have much experience with those yet
am i on the right track?
b
That could definitely work, and a dynamic provider is indeed the way to go. If you get it working please let me know
👍 1
b
hey @billowy-army-68599 i ended getting something basic working (see attached, let me know if you've got any feedback) however in the end i decided to not pursue this. i discovered a couple of annoying issues with the "Instance Refresh" processes, namely it will terminate instances before creating new instances, and it only ever replaces one instance at a time (meaning replacements are really long for large groups or when instances have long bootstrap times). instead I went with your suggestion - creating a CloudFormation stack with just the autoscaling group in it. It allows me to use the same CloudFormation update functionality im used to while still using all the advantages of Pulumi.