Skip to content

Commit

Permalink
Fix WarmPool with --target direct
Browse files Browse the repository at this point in the history
  • Loading branch information
rifelpet committed Jul 30, 2023
1 parent 12b6991 commit f179215
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions upup/pkg/fi/cloudup/awstasks/autoscalinggroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,37 @@ func (e *AutoscalingGroup) CompareWithID() *string {
return e.Name
}

// Track dependencies here to explicitly ignore WarmPool
// because the WarmPool should be created after the ASG, not the other way around.
// The WarmPool struct field is only used for RenderTerraform.
func (e *AutoscalingGroup) GetDependencies(tasks map[string]fi.CloudupTask) []fi.CloudupTask {
var deps []fi.CloudupTask

if e.LoadBalancers != nil {
for _, lb := range e.LoadBalancers {
deps = append(deps, lb)
}
}

if e.TargetGroups != nil {
for _, tg := range e.TargetGroups {
deps = append(deps, tg)
}
}

if e.Subnets != nil {
for _, subnet := range e.Subnets {
deps = append(deps, subnet)
}
}

if e.LaunchTemplate != nil {
deps = append(deps, e.LaunchTemplate)
}

return deps
}

// Find is used to discover the ASG in the cloud provider
func (e *AutoscalingGroup) Find(c *fi.CloudupContext) (*AutoscalingGroup, error) {
cloud := c.T.Cloud.(awsup.AWSCloud)
Expand Down

0 comments on commit f179215

Please sign in to comment.