@@ -944,12 +944,18 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
944
944
var provisionerdWaitGroup sync.WaitGroup
945
945
defer provisionerdWaitGroup .Wait ()
946
946
provisionerdMetrics := provisionerd .NewMetrics (options .PrometheusRegistry )
947
- // Create a list of daemon types. The length is the total number of built in provisioners, and
948
- // the slice value is the type for each.
949
- daemons := append (
950
- fill (make ([]codersdk.ProvisionerType ,vals .Provisioner .DaemonsTerraform .Value ()),codersdk .ProvisionerTypeTerraform ),
951
- fill (make ([]codersdk.ProvisionerType ,vals .Provisioner .DaemonsEcho .Value ()),codersdk .ProvisionerTypeEcho )... ,
952
- )
947
+
948
+ // Create a list of daemon types. The length is the total number of built-in provisioners, and
949
+ // the slice value is the type for each. This is just an easy way to pass the types
950
+ // to a single loop. Ensuring each provisioner has a unique suffix with their index.
951
+ daemons := make ([]codersdk.ProvisionerType ,0 )
952
+ for i := int64 (0 );i < vals .Provisioner .DaemonsTerraform .Value ();i ++ {
953
+ daemons = append (daemons ,codersdk .ProvisionerTypeTerraform )
954
+ }
955
+ for i := int64 (0 );i < vals .Provisioner .DaemonsTerraform .Value ();i ++ {
956
+ daemons = append (daemons ,codersdk .ProvisionerTypeEcho )
957
+ }
958
+
953
959
for i ,provisionerType := range daemons {
954
960
suffix := fmt .Sprintf ("%d" ,i )
955
961
// The suffix is added to the hostname, so we may need to trim to fit into
@@ -2584,11 +2590,3 @@ func getPostgresDB(ctx context.Context, logger slog.Logger, postgresURL string,
2584
2590
2585
2591
return sqlDB ,dbURL ,nil
2586
2592
}
2587
-
2588
- // fill will fill the src with the value 'v'
2589
- func fill [T any ](src []T ,v T ) []T {
2590
- for i := range src {
2591
- src [i ]= v
2592
- }
2593
- return src
2594
- }