Skip to content
Open
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
14 changes: 0 additions & 14 deletions docs/data-sources/network_area.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,7 @@ data "stackit_network_area" "example" {

### Read-Only

- `default_nameservers` (List of String, Deprecated) List of DNS Servers/Nameservers.
- `default_prefix_length` (Number, Deprecated) The default prefix length for networks in the network area.
- `id` (String) Terraform's internal resource ID. It is structured as "`organization_id`,`network_area_id`".
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
- `max_prefix_length` (Number, Deprecated) The maximal prefix length for networks in the network area.
- `min_prefix_length` (Number, Deprecated) The minimal prefix length for networks in the network area.
- `name` (String) The name of the network area.
- `network_ranges` (Attributes List, Deprecated) List of Network ranges. (see [below for nested schema](#nestedatt--network_ranges))
- `project_count` (Number) The amount of projects currently referencing this area.
- `transfer_network` (String, Deprecated) Classless Inter-Domain Routing (CIDR).

<a id="nestedatt--network_ranges"></a>
### Nested Schema for `network_ranges`

Read-Only:

- `network_range_id` (String)
- `prefix` (String)
17 changes: 0 additions & 17 deletions docs/resources/network_area.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,10 @@ When the run is completed, you can remove the import-block. Run `$ terraform pla

### Optional

- `default_nameservers` (List of String, Deprecated) List of DNS Servers/Nameservers for configuration of network area for region `eu01`.
- `default_prefix_length` (Number, Deprecated) The default prefix length for networks in the network area for region `eu01`.
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
- `max_prefix_length` (Number, Deprecated) The maximal prefix length for networks in the network area for region `eu01`.
- `min_prefix_length` (Number, Deprecated) The minimal prefix length for networks in the network area for region `eu01`.
- `network_ranges` (Attributes List, Deprecated) List of Network ranges for configuration of network area for region `eu01`. (see [below for nested schema](#nestedatt--network_ranges))
- `transfer_network` (String, Deprecated) Classless Inter-Domain Routing (CIDR) for configuration of network area for region `eu01`.

### Read-Only

- `id` (String) Terraform's internal resource ID. It is structured as "`organization_id`,`network_area_id`".
- `network_area_id` (String) The network area ID.
- `project_count` (Number) The amount of projects currently referencing this area.

<a id="nestedatt--network_ranges"></a>
### Nested Schema for `network_ranges`

Required:

- `prefix` (String, Deprecated) Classless Inter-Domain Routing (CIDR).

Read-Only:

- `network_range_id` (String, Deprecated)
233 changes: 97 additions & 136 deletions stackit/internal/services/iaas/iaas_acc_test.go

Large diffs are not rendered by default.

86 changes: 0 additions & 86 deletions stackit/internal/services/iaas/networkarea/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@ package networkarea

import (
"context"
"errors"
"fmt"
"net/http"

"github.com/stackitcloud/stackit-sdk-go/core/oapierror"

"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/core"
"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/utils"

"github.com/stackitcloud/terraform-provider-stackit/stackit/internal/conversion"
iaasUtils "github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/iaas/utils"

"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -63,7 +59,6 @@ func (d *networkAreaDataSource) Configure(ctx context.Context, req datasource.Co

// Schema defines the schema for the data source.
func (d *networkAreaDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
deprecationMsg := "Deprecated because of the IaaS API v1 -> v2 migration. Will be removed in May 2026."
description := "Network area datasource schema. Must have a `region` specified in the provider configuration.\n\n" +
"This datasource is for SNA, not VPC, networks."
resp.Schema = schema.Schema{
Expand Down Expand Up @@ -105,67 +100,6 @@ func (d *networkAreaDataSource) Schema(_ context.Context, _ datasource.SchemaReq
int64validator.AtLeast(0),
},
},
"default_nameservers": schema.ListAttribute{
DeprecationMessage: deprecationMsg,
Description: "List of DNS Servers/Nameservers.",
Computed: true,
ElementType: types.StringType,
},
"network_ranges": schema.ListNestedAttribute{
DeprecationMessage: deprecationMsg,
Description: "List of Network ranges.",
Computed: true,
Validators: []validator.List{
listvalidator.SizeAtLeast(1),
listvalidator.SizeAtMost(64),
},
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"network_range_id": schema.StringAttribute{
Computed: true,
Validators: []validator.String{
validate.UUID(),
validate.NoSeparator(),
},
},
"prefix": schema.StringAttribute{
Computed: true,
},
},
},
},
"transfer_network": schema.StringAttribute{
DeprecationMessage: deprecationMsg,
Description: "Classless Inter-Domain Routing (CIDR).",
Computed: true,
},
"default_prefix_length": schema.Int64Attribute{
DeprecationMessage: deprecationMsg,
Description: "The default prefix length for networks in the network area.",
Computed: true,
Validators: []validator.Int64{
int64validator.AtLeast(24),
int64validator.AtMost(29),
},
},
"max_prefix_length": schema.Int64Attribute{
DeprecationMessage: deprecationMsg,
Description: "The maximal prefix length for networks in the network area.",
Computed: true,
Validators: []validator.Int64{
int64validator.AtLeast(24),
int64validator.AtMost(29),
},
},
"min_prefix_length": schema.Int64Attribute{
DeprecationMessage: deprecationMsg,
Description: "The minimal prefix length for networks in the network area.",
Computed: true,
Validators: []validator.Int64{
int64validator.AtLeast(22),
int64validator.AtMost(29),
},
},
"labels": schema.MapAttribute{
Description: "Labels are key-value string pairs which can be attached to a resource container",
ElementType: types.StringType,
Expand Down Expand Up @@ -215,26 +149,6 @@ func (d *networkAreaDataSource) Read(ctx context.Context, req datasource.ReadReq
return
}

// Deprecated: Will be removed in May 2026. Only introduced to make the IaaS v1 -> v2 API migration non-breaking in the Terraform provider.
networkAreaRegionResp, err := d.client.DefaultAPI.GetNetworkAreaRegion(ctx, organizationId, networkAreaId, "eu01").Execute()
if err != nil {
var oapiErr *oapierror.GenericOpenAPIError
ok := errors.As(err, &oapiErr)
if !(ok && (oapiErr.StatusCode == http.StatusNotFound || oapiErr.StatusCode == http.StatusBadRequest)) { // TODO: iaas api returns http 400 in case network area region is not found
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading network area region", fmt.Sprintf("Calling API: %v", err))
return
}

networkAreaRegionResp = &iaas.RegionalArea{}
}

// Deprecated: Will be removed in May 2026. Only introduced to make the IaaS v1 -> v2 API migration non-breaking in the Terraform provider.
err = mapNetworkAreaRegionFields(ctx, networkAreaRegionResp, &model)
if err != nil {
core.LogAndAddError(ctx, &resp.Diagnostics, "Error reading network area region", fmt.Sprintf("Processing API payload: %v", err))
return
}

diags = resp.State.Set(ctx, model)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
Expand Down
Loading
Loading