Description
Follow-up to #1749 / #1750. Two more resources under a network area keep stale state entries when the network area or its regional configuration is deleted outside of Terraform, because they only treat HTTP 404 as "gone" and one of them fails before the delete call.
Observed on 2026-09-07 while reproducing #1749 (provider v0.114.0 and the build from #1750 behave the same here, the code paths are untouched by #1750):
stackit_network_area_region.Read() fails on 400 {"code":400,"msg":"region not enabled"}, which the API answers for GET /v2/organizations/{org}/network-areas/{area}/regions/{region} when the regional configuration was deleted but the network area still exists. Read() only handles 404 (stackit/internal/services/iaas/networkarearegion/resource.go, Read), so every plan fails while the resource is in state.
stackit_network_area_region.Delete() calls wait.ReadyForNetworkAreaDeletionWaitHandler before the delete call. With the network area gone, that wait fails with 404 resource not found: area and Delete() reports Error deleting network area region: Network area ready for deletion waiting: 404 Not Found. The 404 tolerance only covers the DeleteNetworkAreaRegion call itself. Hit with tofu destroy -refresh=false; with a refresh first, Read() removes the resource on the 404 and the problem does not show.
- By code inspection, not reproduced:
stackit_network_area_route Read() and Delete() (stackit/internal/services/iaas/networkarearoute/resource.go) use the same 404-only check under the same /network-areas/{area}/regions/{region}/... path.
Steps to reproduce
resource "stackit_network_area" "area" {
organization_id = var.organization_id
name = "example"
}
resource "stackit_network_area_region" "region" {
organization_id = var.organization_id
network_area_id = stackit_network_area.area.network_area_id
ipv4 = {
network_ranges = [{ prefix = "10.61.0.0/16" }]
transfer_network = "10.62.0.0/24"
}
}
terraform apply
stackit network-area region delete --network-area-id <area> --region eu01 --organization-id <org> -y
terraform plan → problem 1
stackit network-area delete <area> --organization-id <org> -y, then terraform destroy -refresh=false → problem 2
Actual behavior
Error: Error reading network area region
Calling API: 400 Bad Request, status code 400, Body: {"code":400,"msg":"region not enabled"}
Error: Error deleting network area region
Network area ready for deletion waiting: 404 Not Found, status code 404, Body: {"code":404,"msg":"resource not found: area"}
Expected behavior
Read() removes the regional configuration from state when the API answers 404, or 400 for a missing regional configuration (the SDK's DeleteNetworkAreaRegionWaitHandler already treats both as deleted).
Delete() treats a 404 from the readiness wait as "network area already gone" and succeeds.
stackit_network_area_route handles the same cases.
Environment
- OS: macOS 26.6.2 (arm64)
- Terraform version: OpenTofu v1.12.6
- Version of the STACKIT Terraform provider:
v0.114.0
Additional information
relates to #1749
Description
Follow-up to #1749 / #1750. Two more resources under a network area keep stale state entries when the network area or its regional configuration is deleted outside of Terraform, because they only treat HTTP 404 as "gone" and one of them fails before the delete call.
Observed on 2026-09-07 while reproducing #1749 (provider v0.114.0 and the build from #1750 behave the same here, the code paths are untouched by #1750):
stackit_network_area_region.Read()fails on400 {"code":400,"msg":"region not enabled"}, which the API answers forGET /v2/organizations/{org}/network-areas/{area}/regions/{region}when the regional configuration was deleted but the network area still exists.Read()only handles 404 (stackit/internal/services/iaas/networkarearegion/resource.go,Read), so everyplanfails while the resource is in state.stackit_network_area_region.Delete()callswait.ReadyForNetworkAreaDeletionWaitHandlerbefore the delete call. With the network area gone, that wait fails with404 resource not found: areaandDelete()reportsError deleting network area region: Network area ready for deletion waiting: 404 Not Found. The 404 tolerance only covers theDeleteNetworkAreaRegioncall itself. Hit withtofu destroy -refresh=false; with a refresh first,Read()removes the resource on the 404 and the problem does not show.stackit_network_area_routeRead()andDelete()(stackit/internal/services/iaas/networkarearoute/resource.go) use the same 404-only check under the same/network-areas/{area}/regions/{region}/...path.Steps to reproduce
terraform applystackit network-area region delete --network-area-id <area> --region eu01 --organization-id <org> -yterraform plan→ problem 1stackit network-area delete <area> --organization-id <org> -y, thenterraform destroy -refresh=false→ problem 2Actual behavior
Expected behavior
Read()removes the regional configuration from state when the API answers 404, or 400 for a missing regional configuration (the SDK'sDeleteNetworkAreaRegionWaitHandleralready treats both as deleted).Delete()treats a 404 from the readiness wait as "network area already gone" and succeeds.stackit_network_area_routehandles the same cases.Environment
v0.114.0Additional information
relates to #1749