fix(iaas): remove routing table from state when it no longer exists - #1750
Open
devpie wants to merge 1 commit into
Open
fix(iaas): remove routing table from state when it no longer exists#1750devpie wants to merge 1 commit into
devpie wants to merge 1 commit into
Conversation
This was referenced Sep 7, 2026
devpie
force-pushed
the
fix/routing-table-network-area-gone
branch
from
September 8, 2026 08:23
703fee7 to
cdbce2c
Compare
devpie
force-pushed
the
fix/routing-table-network-area-gone
branch
from
September 8, 2026 08:41
cdbce2c to
0779e58
Compare
Contributor
|
Hello @devpie, thank you for the contribution. I have created a internal tracking issue and we will review your contribution soon. Best regards |
The IaaS API answers HTTP 404 for routing tables and routes of a network area whose region (stackit_network_area_region) or the area itself has been deleted. Read() of stackit_routing_table turned that 404 into an error diagnostic (utils.LogError followed by RemoveResource); Terraform keeps the prior state when a read reports an error, so every refresh of the stale resource failed. The RemoveResource call after any other API error was dead code for the same reason. Read() now removes the resource from state on 404 without an error diagnostic and reports every other error while keeping the state, the pattern stackit_routing_table_route.Read() already uses. A resource- level test covers 200, 404, 403, 500 and a transport error. The schema descriptions of both resources document the platform's cascade and the provider's behaviour. Fixes stackitcloud#1749 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
devpie
force-pushed
the
fix/routing-table-network-area-gone
branch
from
September 8, 2026 11:23
0779e58 to
26799e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
fixes #1749
When a
stackit_network_areano longer exists (the area or its regional configuration was deleted outside of Terraform), the IaaS API answers HTTP 404 for the routing tables and routes that belonged to it (verified against the API, see #1749).Read()ofstackit_routing_tableturned that 404 into an error diagnostic: it calledutils.LogErrorand thenRemoveResource, and Terraform keeps the prior state when a read reports an error. So every refresh of the stale resource failed, and aremovedblock withlifecycle { destroy = true }failed with it. The same code removed the resource from state after any API error, which was equally ineffective for the same reason.Changes:
stackit_routing_table.Read()removes the resource from state on HTTP 404 without an error diagnostic and reports every other error while keeping the state — the patternstackit_routing_table_route.Read()already uses. The error summary follows the other IaaS resources (Error reading routing table).Read()against a mocked API: 200 (state compared field by field), 404, 403, 500 and a transport error. It fails onmainfor the 404, 403 and 500 cases.stackit_network_area_region, and how the provider reacts.Verification against the real API (provider v0.114.0 vs. this build, OpenTofu 1.12.6; details in #1749): with the network area deleted,
tofu plan -refresh-onlyfails on v0.114.0 withError: Reading routing tableand succeeds with this build, reporting routing table and route as deleted;tofu destroy -refresh=falsesucceeds for the already deleted routing table and route.Not part of this PR:
stackit_network_area_regionandstackit_network_area_routehave related gaps, see #1751.Checklist
make fmtexamples/directory) — not needed, no attribute changedmake generate-docs(will be checked by CI)make test(will be checked by CI)make lint(will be checked by CI)🤖 Generated with Claude Code