diff --git a/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go b/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go index 755af1656b1c..cdf923f28cb7 100644 --- a/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go +++ b/cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go @@ -451,12 +451,18 @@ func createServer(n *hetznerNodeGroup) error { return fmt.Errorf("could not create server type %s in region %s: %v", n.instanceType, n.region, err) } - action := serverCreateResult.Action server := serverCreateResult.Server - err = waitForServerAction(n.manager, server.Name, action) - if err != nil { - _ = n.manager.deleteServer(server) - return fmt.Errorf("failed to start server %s error: %v", server.Name, err) + + actions := []*hcloud.Action{serverCreateResult.Action} + actions = append(actions, serverCreateResult.NextActions...) + + // Delete the server if any action (most importantly create_server & start_server) fails + for _, action := range actions { + err = waitForServerAction(n.manager, server.Name, action) + if err != nil { + _ = n.manager.deleteServer(server) + return fmt.Errorf("failed to start server %s error: %v", server.Name, err) + } } return nil