Skip to content

Migration path for deprecated stackit_network_area fields #1108

@HartmannVolker

Description

@HartmannVolker

Description

When using the stackit_network_area resource, I get a deprecation warning that I should use the stackit_network_area_region instead of the existing fields in the stackit_network_area.

The problem is: I can't remove the deprecated fields from my existing resource, because that would cause a recreation of the network area in STACKIT.

Steps to reproduce

  1. Have an existing stackit_network_area with network_ranges and transfer_network
  2. See the deprecation warning in the terraform output
  3. Create a new stackit_network_area_region for the network_ranges and transfer_network configuration and an import block to import the existing config from the old resource.
  4. Remove network_ranges and transfer_network from the stackit_network_area
  5. Run terraform plan & see that stackit_network_area.example must be replaced
resource "stackit_network_area" "example" {
  organization_id = local.organisation_id
  name            = "Example"
}

resource "stackit_network_area_region" "ipv4" {
  organization_id = local.organisation_id
  network_area_id = stackit_network_area.example.network_area_id
  ipv4 = {
    transfer_network = "11.2.0.0/24"
    network_ranges = [
      {
        prefix = "11.0.0.0/16"
      }
    ]
  }
}

import {
  to = stackit_network_area_region.ipv4
  id = "${local.organisation_id},${stackit_network_area.example.network_area_id},eu01"
}

Actual behavior

The old network area is getting replaced which can cause a number of unwanted side effects

Expected behavior

The old network area is not been replaced and the provider notices that the configuration is moved to the stackit_network_area_region resource.

Alternative: The documentation or the deprecation warning contains a migration guideline.

Environment

  • OS: MacOS 26.1 (25B78)
  • Terraform version (see terraform --version): v1.13.5
  • Version of the STACKIT Terraform provider: 0.76.0

Additional information

I could add ignore_changes to the stackit_network_area resource, but I'm not sure how this will behave with future updates of the provider.

Example:

resource "stackit_network_area" "example" {
  organization_id = local.organisation_id
  name            = "Example"

  # Deprecated fields, will be removed in future versions
  lifecycle {
    ignore_changes = [
      network_ranges,
      transfer_network,
    ]
  }
}

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions