From 514fe6e7f1168422792a9bb97c649e8386728397 Mon Sep 17 00:00:00 2001 From: Manuel Vaas Date: Fri, 7 Aug 2026 18:25:51 +0200 Subject: [PATCH] fix(ske): nil pointer when gateway api is not set relates to #1671 --- stackit/internal/services/ske/cluster/resource.go | 2 +- .../internal/services/ske/cluster/resource_test.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/stackit/internal/services/ske/cluster/resource.go b/stackit/internal/services/ske/cluster/resource.go index c2d2051ec..063a058f5 100644 --- a/stackit/internal/services/ske/cluster/resource.go +++ b/stackit/internal/services/ske/cluster/resource.go @@ -2161,7 +2161,7 @@ func mapExtensions(ctx context.Context, cl *ske.Cluster, m *Model) error { dnsExtension := types.ObjectNull(dnsTypes) if cl.Extensions.Dns != nil { enabled := types.BoolValue(cl.Extensions.Dns.Enabled) - gatewayApi := types.BoolValue(*cl.Extensions.Dns.GatewayApi) + gatewayApi := types.BoolPointerValue(cl.Extensions.Dns.GatewayApi) zonesList, diags := types.ListValueFrom(ctx, types.StringType, cl.Extensions.Dns.Zones) if diags.HasError() { diff --git a/stackit/internal/services/ske/cluster/resource_test.go b/stackit/internal/services/ske/cluster/resource_test.go index ec6ad006e..5e330305f 100644 --- a/stackit/internal/services/ske/cluster/resource_test.go +++ b/stackit/internal/services/ske/cluster/resource_test.go @@ -342,9 +342,8 @@ func TestMapFields(t *testing.T) { Enabled: true, }, Dns: &ske.DNS{ - Zones: nil, - Enabled: true, - GatewayApi: new(true), + Zones: nil, + Enabled: true, }, ApplicationLoadBalancer: &ske.ApplicationLoadBalancer{ Enabled: true, @@ -382,7 +381,7 @@ func TestMapFields(t *testing.T) { "dns": types.ObjectValueMust(dnsTypes, map[string]attr.Value{ "enabled": types.BoolValue(true), "zones": types.ListNull(types.StringType), - "gateway_api": types.BoolValue(true), + "gateway_api": types.BoolNull(), }), "application_load_balancer": types.ObjectValueMust(applicationLoadBalancerTypes, map[string]attr.Value{ "enabled": types.BoolValue(true), @@ -409,7 +408,7 @@ func TestMapFields(t *testing.T) { "dns": types.ObjectValueMust(dnsTypes, map[string]attr.Value{ "enabled": types.BoolValue(false), "zones": types.ListNull(types.StringType), - "gateway_api": types.BoolValue(false), + "gateway_api": types.BoolNull(), }), "application_load_balancer": types.ObjectValueMust(applicationLoadBalancerTypes, map[string]attr.Value{ "enabled": types.BoolValue(false), @@ -450,7 +449,7 @@ func TestMapFields(t *testing.T) { "dns": types.ObjectValueMust(dnsTypes, map[string]attr.Value{ "enabled": types.BoolValue(false), "zones": types.ListNull(types.StringType), - "gateway_api": types.BoolValue(false), + "gateway_api": types.BoolNull(), }), "application_load_balancer": types.ObjectValueMust(applicationLoadBalancerTypes, map[string]attr.Value{ "enabled": types.BoolValue(false),