-
Notifications
You must be signed in to change notification settings - Fork 45
Description
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
- Have an existing
stackit_network_areawith network_ranges and transfer_network - See the deprecation warning in the terraform output
- Create a new
stackit_network_area_regionfor the network_ranges and transfer_network configuration and an import block to import the existing config from the old resource. - Remove network_ranges and transfer_network from the
stackit_network_area - Run
terraform plan& see thatstackit_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,
]
}
}