Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/data-sources/ske_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Read-Only:
Read-Only:

- `acl` (Attributes) Cluster access control configuration (see [below for nested schema](#nestedatt--extensions--acl))
- `application_load_balancer` (Attributes) Application Load Balancer extension. (see [below for nested schema](#nestedatt--extensions--application_load_balancer))
- `argus` (Attributes, Deprecated) A single argus block as defined below. This field is deprecated and will be removed 06 January 2026. (see [below for nested schema](#nestedatt--extensions--argus))
- `dns` (Attributes) DNS extension configuration (see [below for nested schema](#nestedatt--extensions--dns))
- `observability` (Attributes) A single observability block as defined below. (see [below for nested schema](#nestedatt--extensions--observability))
Expand All @@ -82,6 +83,14 @@ Read-Only:
- `enabled` (Boolean) Is ACL enabled?


<a id="nestedatt--extensions--application_load_balancer"></a>
### Nested Schema for `extensions.application_load_balancer`

Read-Only:

- `enabled` (Boolean) Enables the application load balancer extension.


<a id="nestedatt--extensions--argus"></a>
### Nested Schema for `extensions.argus`

Expand Down
11 changes: 10 additions & 1 deletion docs/resources/ske_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ Optional:
Optional:

- `acl` (Attributes) Cluster access control configuration. (see [below for nested schema](#nestedatt--extensions--acl))
- `application_load_balancer` (Attributes) Application Load Balancer extension. (see [below for nested schema](#nestedatt--extensions--application_load_balancer))
- `argus` (Attributes, Deprecated) A single argus block as defined below. This field is deprecated and will be removed 06 January 2026. (see [below for nested schema](#nestedatt--extensions--argus))
- `dns` (Attributes) DNS extension configuration (see [below for nested schema](#nestedatt--extensions--dns))
- `observability` (Attributes) A single observability block as defined below. (see [below for nested schema](#nestedatt--extensions--observability))
Expand All @@ -148,6 +149,14 @@ Required:
- `enabled` (Boolean) Is ACL enabled?


<a id="nestedatt--extensions--application_load_balancer"></a>
### Nested Schema for `extensions.application_load_balancer`

Required:

- `enabled` (Boolean) Enables the application load balancer extension. Note: This feature is in private preview. Enabling application load balancer extension is only possible for enabled accounts. Otherwise the request will be rejected.


<a id="nestedatt--extensions--argus"></a>
### Nested Schema for `extensions.argus`

Expand Down Expand Up @@ -222,7 +231,7 @@ Optional:

Optional:

- `access_scope` (String) Access scope of the control plane. It defines if the Kubernetes control plane is public or only available inside a STACKIT Network Area.Possible values are: `PUBLIC`, `SNA`. The field is immutable!
- `access_scope` (String) Access scope of the control plane. It defines if the Kubernetes control plane is public or only available inside a STACKIT Network Area. This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected.Possible values are: `PUBLIC`, `SNA`. The field is immutable!

## Import

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ require (
github.com/stackitcloud/stackit-sdk-go/services/serviceaccount v0.20.0
github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v1.7.0
github.com/stackitcloud/stackit-sdk-go/services/sfs v0.11.0
github.com/stackitcloud/stackit-sdk-go/services/ske v1.20.0
github.com/stackitcloud/stackit-sdk-go/services/ske v1.21.0
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.16.1
github.com/stackitcloud/stackit-sdk-go/services/telemetrylink v0.4.0
github.com/stackitcloud/stackit-sdk-go/services/telemetryrouter v0.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v1.7.0 h1:TNZH
github.com/stackitcloud/stackit-sdk-go/services/serviceenablement v1.7.0/go.mod h1:fXq3TmVLb4JMSve989NFFViMFoYa83s7M3hJWgN6mdQ=
github.com/stackitcloud/stackit-sdk-go/services/sfs v0.11.0 h1:YhQ2GF+AyHVUps1iEjLj7z6OlzBzMGyD5nwHaZ0pXus=
github.com/stackitcloud/stackit-sdk-go/services/sfs v0.11.0/go.mod h1:jMlBoXqrPNX5nXbo6oT7exalqilw1jiLPoIp4Cn0CdI=
github.com/stackitcloud/stackit-sdk-go/services/ske v1.20.0 h1:ZgXPfaGRFYFpMSFhW+sVBfUyxY6Va1Cx0Py1nOivCLc=
github.com/stackitcloud/stackit-sdk-go/services/ske v1.20.0/go.mod h1:TbqmZhLMofmfl+HhVl6oHYcI3zvXTm1vRjN3A/fOkM4=
github.com/stackitcloud/stackit-sdk-go/services/ske v1.21.0 h1:eu9PhRdL2GkXpHtf4NN9YBCUYcARdvAwq+g/FW4hmi4=
github.com/stackitcloud/stackit-sdk-go/services/ske v1.21.0/go.mod h1:TbqmZhLMofmfl+HhVl6oHYcI3zvXTm1vRjN3A/fOkM4=
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.16.1 h1:pjFVw2Tc0cSfAzmyZRiLknuKSADs7nPXNUyrM216CwQ=
github.com/stackitcloud/stackit-sdk-go/services/sqlserverflex v1.16.1/go.mod h1:AiUoMAqQcOlMgDtkVJlqI7P/VGD5xjN3dYjERGnwN/M=
github.com/stackitcloud/stackit-sdk-go/services/telemetrylink v0.4.0 h1:RG+cZzvIb+NoVNYemvwG5UHR9qEqea6IuHVYtojeBbQ=
Expand Down
10 changes: 10 additions & 0 deletions stackit/internal/services/ske/cluster/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,16 @@ func (r *clusterDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
},
},
},
"application_load_balancer": schema.SingleNestedAttribute{
Description: "Application Load Balancer extension.",
Computed: true,
Attributes: map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
Description: "Enables the application load balancer extension.",
Computed: true,
},
},
},
},
},
"region": schema.StringAttribute{
Expand Down
118 changes: 90 additions & 28 deletions stackit/internal/services/ske/cluster/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,20 @@ var hibernationTypes = map[string]attr.Type{

// Struct corresponding to Model.Extensions
type extensions struct {
Argus types.Object `tfsdk:"argus"`
Observability types.Object `tfsdk:"observability"`
ACL types.Object `tfsdk:"acl"`
DNS types.Object `tfsdk:"dns"`
Argus types.Object `tfsdk:"argus"`
Observability types.Object `tfsdk:"observability"`
ApplicationLoadBalancer types.Object `tfsdk:"application_load_balancer"`
ACL types.Object `tfsdk:"acl"`
DNS types.Object `tfsdk:"dns"`
}

// Types corresponding to extensions
var extensionsTypes = map[string]attr.Type{
"argus": basetypes.ObjectType{AttrTypes: argusTypes},
"observability": basetypes.ObjectType{AttrTypes: observabilityTypes},
"acl": basetypes.ObjectType{AttrTypes: aclTypes},
"dns": basetypes.ObjectType{AttrTypes: dnsTypes},
"argus": basetypes.ObjectType{AttrTypes: argusTypes},
"observability": basetypes.ObjectType{AttrTypes: observabilityTypes},
"application_load_balancer": basetypes.ObjectType{AttrTypes: applicationLoadBalancerTypes},
"acl": basetypes.ObjectType{AttrTypes: aclTypes},
"dns": basetypes.ObjectType{AttrTypes: dnsTypes},
}

// Struct corresponding to extensions.ACL
Expand All @@ -246,6 +248,16 @@ var argusTypes = map[string]attr.Type{
"argus_instance_id": basetypes.StringType{},
}

// Struct corresponding to extensions.applicationLoadBalancer
type applicationLoadBalancer struct {
Enabled types.Bool `tfsdk:"enabled"`
}

// Types corresponding to applicationLoadBalancer
var applicationLoadBalancerTypes = map[string]attr.Type{
"enabled": basetypes.BoolType{},
}

// Struct corresponding to extensions.Observability
type observability struct {
Enabled types.Bool `tfsdk:"enabled"`
Expand Down Expand Up @@ -701,7 +713,7 @@ func (r *clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, re
},
Attributes: map[string]schema.Attribute{
"access_scope": schema.StringAttribute{
Description: "Access scope of the control plane. It defines if the Kubernetes control plane is public or only available inside a STACKIT Network Area." + utils.FormatPossibleValues(sdkUtils.EnumSliceToStringSlice(ske.AllowedAccessScopeEnumValues)...) + " The field is immutable!",
Description: "Access scope of the control plane. It defines if the Kubernetes control plane is public or only available inside a STACKIT Network Area. This feature is in private preview. Supplying this object is only permitted for enabled accounts. If your account does not have access, the request will be rejected." + utils.FormatPossibleValues(sdkUtils.EnumSliceToStringSlice(ske.AllowedAccessScopeEnumValues)...) + " The field is immutable!",
Optional: true,
Computed: true,
PlanModifiers: []planmodifier.String{
Expand Down Expand Up @@ -815,6 +827,16 @@ func (r *clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, re
},
},
},
"application_load_balancer": schema.SingleNestedAttribute{
Description: "Application Load Balancer extension.",
Optional: true,
Attributes: map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
Description: "Enables the application load balancer extension. Note: This feature is in private preview. Enabling application load balancer extension is only possible for enabled accounts. Otherwise the request will be rejected.",
Required: true,
},
},
},
},
},
"region": schema.StringAttribute{
Expand Down Expand Up @@ -1448,6 +1470,19 @@ func toExtensionsPayload(ctx context.Context, m *Model) (*ske.Extension, error)
}
}

var skeApplicationLoadBalancer *ske.ApplicationLoadBalancer
if !(ex.ApplicationLoadBalancer.IsNull() || ex.ApplicationLoadBalancer.IsUnknown()) {
applicationLoadBalancer := applicationLoadBalancer{}
diags = ex.ApplicationLoadBalancer.As(ctx, &applicationLoadBalancer, basetypes.ObjectAsOptions{})
if diags.HasError() {
return nil, fmt.Errorf("converting extensions.applicationLoadBalancer object: %v", diags.Errors())
}

skeApplicationLoadBalancer = &ske.ApplicationLoadBalancer{
Enabled: applicationLoadBalancer.Enabled.ValueBool(),
}
}

var skeDNS *ske.DNS
if !(ex.DNS.IsNull() || ex.DNS.IsUnknown()) {
dns := dns{}
Expand All @@ -1469,9 +1504,10 @@ func toExtensionsPayload(ctx context.Context, m *Model) (*ske.Extension, error)
}

return &ske.Extension{
Acl: skeAcl,
Observability: skeObservability,
Dns: skeDNS,
Acl: skeAcl,
Observability: skeObservability,
ApplicationLoadBalancer: skeApplicationLoadBalancer,
Dns: skeDNS,
}, nil
}

Expand Down Expand Up @@ -1943,15 +1979,15 @@ func getMaintenanceTimes(ctx context.Context, cl *ske.Cluster, m *Model) (startT
return startTime, endTime, nil
}

func checkDisabledExtensions(ctx context.Context, ex *extensions) (aclDisabled, observabilityDisabled, dnsDisabled bool, err error) {
func checkDisabledExtensions(ctx context.Context, ex *extensions) (aclDisabled, observabilityDisabled, dnsDisabled, applicationLoadBalancerDisabled bool, err error) {
var diags diag.Diagnostics
acl := acl{}
if ex.ACL.IsNull() {
acl.Enabled = types.BoolValue(false)
} else {
diags = ex.ACL.As(ctx, &acl, basetypes.ObjectAsOptions{})
if diags.HasError() {
return false, false, false, fmt.Errorf("converting extensions.acl object: %v", diags.Errors())
return false, false, false, false, fmt.Errorf("converting extensions.acl object: %v", diags.Errors())
}
}

Expand All @@ -1962,14 +1998,14 @@ func checkDisabledExtensions(ctx context.Context, ex *extensions) (aclDisabled,
argus := argus{}
diags = ex.Argus.As(ctx, &argus, basetypes.ObjectAsOptions{})
if diags.HasError() {
return false, false, false, fmt.Errorf("converting extensions.argus object: %v", diags.Errors())
return false, false, false, false, fmt.Errorf("converting extensions.argus object: %v", diags.Errors())
}
observability.Enabled = argus.Enabled
observability.InstanceId = argus.ArgusInstanceId
} else {
diags = ex.Observability.As(ctx, &observability, basetypes.ObjectAsOptions{})
if diags.HasError() {
return false, false, false, fmt.Errorf("converting extensions.observability object: %v", diags.Errors())
return false, false, false, false, fmt.Errorf("converting extensions.observability object: %v", diags.Errors())
}
}

Expand All @@ -1979,11 +2015,21 @@ func checkDisabledExtensions(ctx context.Context, ex *extensions) (aclDisabled,
} else {
diags = ex.DNS.As(ctx, &dns, basetypes.ObjectAsOptions{})
if diags.HasError() {
return false, false, false, fmt.Errorf("converting extensions.dns object: %v", diags.Errors())
return false, false, false, false, fmt.Errorf("converting extensions.dns object: %v", diags.Errors())
}
}

return !acl.Enabled.ValueBool(), !observability.Enabled.ValueBool(), !dns.Enabled.ValueBool(), nil
applicationLoadBalancer := applicationLoadBalancer{}
if ex.ApplicationLoadBalancer.IsNull() {
applicationLoadBalancer.Enabled = types.BoolValue(false)
} else {
diags = ex.ApplicationLoadBalancer.As(ctx, &applicationLoadBalancer, basetypes.ObjectAsOptions{})
if diags.HasError() {
return false, false, false, false, fmt.Errorf("converting extensions.applicationLoadBalancer object: %v", diags.Errors())
}
}

return !acl.Enabled.ValueBool(), !observability.Enabled.ValueBool(), !dns.Enabled.ValueBool(), !applicationLoadBalancer.Enabled.ValueBool(), nil
}

func mapExtensions(ctx context.Context, cl *ske.Cluster, m *Model) error {
Expand All @@ -2010,11 +2056,11 @@ func mapExtensions(ctx context.Context, cl *ske.Cluster, m *Model) error {
// If we parse that object into the terraform model, it will produce an inconsistent result after apply
// error

aclDisabled, observabilityDisabled, dnsDisabled, err := checkDisabledExtensions(ctx, &ex)
aclDisabled, observabilityDisabled, dnsDisabled, applicationLoadBalancerDisabled, err := checkDisabledExtensions(ctx, &ex)
if err != nil {
return fmt.Errorf("checking if extensions are disabled: %w", err)
}
disabledExtensions := aclDisabled && observabilityDisabled && dnsDisabled
disabledExtensions := aclDisabled && observabilityDisabled && dnsDisabled && applicationLoadBalancerDisabled

if skeUtils.IsEmptyExtension(cl.Extensions) && (disabledExtensions || m.Extensions.IsNull()) {
if m.Extensions.Attributes() == nil {
Expand Down Expand Up @@ -2089,6 +2135,20 @@ func mapExtensions(ctx context.Context, cl *ske.Cluster, m *Model) error {
}
}

applicationLoadBalancerExtension := types.ObjectNull(applicationLoadBalancerTypes)
if cl.Extensions.ApplicationLoadBalancer != nil {
applicationLoadBalancerValues := map[string]attr.Value{
"enabled": types.BoolValue(cl.Extensions.ApplicationLoadBalancer.Enabled),
}

applicationLoadBalancerExtension, diags = types.ObjectValue(applicationLoadBalancerTypes, applicationLoadBalancerValues)
if diags.HasError() {
return fmt.Errorf("creating applicationLoadBalancer: %w", core.DiagsToError(diags))
}
} else if applicationLoadBalancerDisabled && !ex.ApplicationLoadBalancer.IsNull() {
applicationLoadBalancerExtension = ex.ApplicationLoadBalancer
}

dnsExtension := types.ObjectNull(dnsTypes)
if cl.Extensions.Dns != nil {
enabled := types.BoolValue(cl.Extensions.Dns.Enabled)
Expand Down Expand Up @@ -2116,17 +2176,19 @@ func mapExtensions(ctx context.Context, cl *ske.Cluster, m *Model) error {
var extensionsValues map[string]attr.Value
if utils.IsUndefined(ex.Argus) {
extensionsValues = map[string]attr.Value{
"acl": aclExtension,
"argus": types.ObjectNull(argusTypes),
"observability": observabilityExtension,
"dns": dnsExtension,
"acl": aclExtension,
"argus": types.ObjectNull(argusTypes),
"observability": observabilityExtension,
"application_load_balancer": applicationLoadBalancerExtension,
"dns": dnsExtension,
}
} else {
extensionsValues = map[string]attr.Value{
"acl": aclExtension,
"argus": argusExtension,
"observability": types.ObjectNull(observabilityTypes),
"dns": dnsExtension,
"acl": aclExtension,
"argus": argusExtension,
"observability": types.ObjectNull(observabilityTypes),
"application_load_balancer": applicationLoadBalancerExtension,
"dns": dnsExtension,
}
}

Expand Down
Loading
Loading