Skip to content

Commit 69706a3

Browse files
committed
fix: correct rebase errors for allow privatelink/psc with no allowed principals
Rebase error, ctx was removed in f9d2e63 but ListValueFrom(ctx, ...) was added in 492d69c.
1 parent 0946a82 commit 69706a3

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

redpanda/resources/cluster/cluster.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -290,18 +290,15 @@ func generateModel(cfg models.Cluster, cluster *controlplanev1beta2.Cluster) (*m
290290
}
291291

292292
if !isAwsPrivateLinkSpecNil(cluster.AwsPrivateLink) {
293-
ap, dg := types.ListValueFrom(ctx, types.StringType, cluster.AwsPrivateLink.AllowedPrincipals)
294-
if dg.HasError() {
295-
return nil, fmt.Errorf("failed to parse AWS Private Link: %v", dg)
296-
}
293+
ap := utils.StringSliceToTypeList(cluster.AwsPrivateLink.AllowedPrincipals)
297294
if ap.IsNull() {
298295
// this must match the user's plan, which is currently required to be non-null
299296
ap = types.ListValueMust(types.StringType, []attr.Value{})
300297
}
301298
output.AwsPrivateLink = &models.AwsPrivateLink{
302299
Enabled: types.BoolValue(cluster.AwsPrivateLink.Enabled),
303300
ConnectConsole: types.BoolValue(cluster.AwsPrivateLink.ConnectConsole),
304-
AllowedPrincipals: utils.StringSliceToTypeList(cluster.AwsPrivateLink.AllowedPrincipals),
301+
AllowedPrincipals: ap,
305302
}
306303
}
307304
if !isGcpPrivateServiceConnectSpecNil(cluster.GcpPrivateServiceConnect) {
@@ -313,18 +310,15 @@ func generateModel(cfg models.Cluster, cluster *controlplanev1beta2.Cluster) (*m
313310
}
314311

315312
if !isAzurePrivateLinkSpecNil(cluster.AzurePrivateLink) {
316-
as, dg := types.ListValueFrom(ctx, types.StringType, cluster.AzurePrivateLink.AllowedSubscriptions)
317-
if dg.HasError() {
318-
return nil, fmt.Errorf("failed to parse Azure Private Link: %v", dg)
319-
}
313+
as := utils.StringSliceToTypeList(cluster.AzurePrivateLink.AllowedSubscriptions)
320314
if as.IsNull() {
321315
// this must match the user's plan, which is currently required to be non-null
322316
as = types.ListValueMust(types.StringType, []attr.Value{})
323317
}
324318
output.AzurePrivateLink = &models.AzurePrivateLink{
325319
Enabled: types.BoolValue(cluster.AzurePrivateLink.Enabled),
326320
ConnectConsole: types.BoolValue(cluster.AzurePrivateLink.ConnectConsole),
327-
AllowedSubscriptions: utils.StringSliceToTypeList(cluster.AzurePrivateLink.AllowedSubscriptions),
321+
AllowedSubscriptions: as,
328322
}
329323
}
330324
kAPI := toMtlsModel(cluster.GetKafkaApi().GetMtls())

0 commit comments

Comments
 (0)