Feat: add egress_address_ranges attribute to ske resource (#672)

* feat: add egress_address_ranges attribute to ske resource

* docs: generate new docs for ske
This commit is contained in:
Mauritz Uphoff 2025-02-10 10:14:11 +01:00 committed by GitHub
parent 170041f807
commit c4e25f560b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 40 additions and 5 deletions

View file

@ -77,6 +77,7 @@ type Model struct {
Network types.Object `tfsdk:"network"`
Hibernations types.List `tfsdk:"hibernations"`
Extensions types.Object `tfsdk:"extensions"`
EgressAddressRanges types.List `tfsdk:"egress_address_ranges"`
}
// Struct corresponding to Model.NodePools[i]
@ -374,6 +375,11 @@ func (r *clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, re
Description: "Flag to specify if privileged mode for containers is enabled or not.\nThis should be used with care since it also disables a couple of other features like the use of some volume type (e.g. PVCs).\nDeprecated as of Kubernetes 1.25 and later",
Optional: true,
},
"egress_address_ranges": schema.ListAttribute{
Description: "The outgoing network ranges (in CIDR notation) of traffic originating from workload on the cluster.",
Computed: true,
ElementType: types.StringType,
},
"node_pools": schema.ListNestedAttribute{
Description: "One or more `node_pool` block as defined below.",
Required: true,
@ -1320,6 +1326,15 @@ func mapFields(ctx context.Context, cl *ske.Cluster, m *Model) error {
m.AllowPrivilegedContainers = types.BoolPointerValue(cl.Kubernetes.AllowPrivilegedContainers)
}
m.EgressAddressRanges = types.ListNull(types.StringType)
if cl.Status != nil {
var diags diag.Diagnostics
m.EgressAddressRanges, diags = types.ListValueFrom(ctx, types.StringType, cl.Status.EgressAddressRanges)
if diags.HasError() {
return fmt.Errorf("map egressAddressRanges: %w", core.DiagsToError(diags))
}
}
err := mapNodePools(ctx, cl, m)
if err != nil {
return fmt.Errorf("map node_pools: %w", err)