Skip to content

Commit

Permalink
Fix auto scaling group changes when using spot instances
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciprian Hacman committed Nov 7, 2020
1 parent 6a57543 commit 4317f55
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,13 +455,14 @@ func (v *AutoscalingGroup) RenderAWS(t *awsup.AWSAPITarget, a, e, changes *Autos
}

if changes.LaunchTemplate != nil {
// @note: at the moment we are only using launch templates when using mixed instance policies,
// but this might change
setup(request).LaunchTemplate = &autoscaling.LaunchTemplate{
LaunchTemplateSpecification: &autoscaling.LaunchTemplateSpecification{
LaunchTemplateName: changes.LaunchTemplate.ID,
Version: &launchTemplateVersion,
},
spec := &autoscaling.LaunchTemplateSpecification{
LaunchTemplateId: changes.LaunchTemplate.ID,
Version: aws.String("$Latest"),
}
if e.UseMixedInstancesPolicy() {
setup(request).LaunchTemplate = &autoscaling.LaunchTemplate{LaunchTemplateSpecification: spec}
} else {
request.LaunchTemplate = spec
}
changes.LaunchTemplate = nil
}
Expand Down

0 comments on commit 4317f55

Please sign in to comment.