fix(file_storage): tolerate released private IP during mount target read (GetPrivateIp 404 wedges refresh) - #2593
Conversation
The File Storage service releases a mount target's private IP early in
the deletion flow, while GetMountTarget keeps returning the record (in
DELETING and then DELETED state) still carrying the stale privateIpIds
reference. The resource read hydrates ip_address/hostname_label from
that reference unconditionally, so GetPrivateIp returns 404 and the
whole refresh fails.
Consequence: any plan/apply/destroy that refreshes state while a mount
target deletion is in flight - most commonly a destroy retry after an
unrelated transient failure - errors permanently with
Error returned by VirtualNetwork Service. Http Status Code: 404.
Operation Name: GetPrivateIp
with oci_file_storage_mount_target.<name>
until the record ages out, and the state can only be recovered with a
manual 'terraform state rm'.
Fix, two guards:
- skip private IP hydration when the mount target is DELETING/DELETED
(the reference is stale by definition there);
- treat GetPrivateIp 404 as absent details rather than a read error,
covering the race where the IP is released before the lifecycle
state flips.
Reproduced live on 8.25.0: create a mount target, delete it out of
band, 'terraform plan -refresh-only' fails with the 404; with this fix
the same refresh reports the resource as deleted and converges.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Dee Kryvenko <dmytro.kryvenko@paramount.com>
|
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA). To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
|
Thank you for your valuable contribution. We greatly appreciate your efforts in submitting this pull request. However, I regret to inform you that we are unable to merge it directly on GitHub at this time. Our internal policy requires that all pull requests undergo thorough local testing and review before they can be merged into the main codebase. This process ensures the quality and stability of Terraform-Provider-OCI. We understand that this may cause some inconvenience, but please rest assured that your contribution is highly valued. Our team will carefully review and test your changes locally to ensure they meet our standards. We appreciate your understanding and patience in this matter. If you have any questions or need further assistance, please don't hesitate to reach out. Thank you once again for your contribution. |
|
Thanks @dee-kryvenko for the PR. Looks good. I will get this fix merged in. |
|
This is now pending release. |
…rivateIp 404 wedges refresh) - GitHub PR #2593
Problem
The File Storage service releases a mount target's private IP early in the deletion flow, while
GetMountTargetkeeps returning the record — inDELETINGand thenDELETEDstate — still carrying the staleprivateIpIdsreference. The mount target resource read hydratesip_address/hostname_labelfrom that reference unconditionally (setPrivateIpDetails), soGetPrivateIpreturns 404 and the entire refresh fails:Impact
Any
plan/apply/destroythat refreshes state while a mount target deletion is in flight hits this. The most damaging shape: a multi-resourcedestroyissues the mount target deletion, fails on an unrelated transient elsewhere in the graph, and then every retry fails at refresh on the 404 — permanently, until the deleted record ages out server-side (observed 40+ minutes). The only recovery is a manualterraform state rm. We reproduced this in CI on two independent clusters the same day (each froze at the identical refresh point), and then minimally on a scratch configuration.Reproduction (provider 8.25.0)
terraform apply.oci fs mount-target delete --mount-target-id ....terraform plan -refresh-only→ fails with theGetPrivateIp404 above.Fix
Two guards in
file_storage_mount_target_resource.go:DELETING/DELETED— theprivateIpIdsreference is stale by definition in those states.GetPrivateIp404 as absent details rather than a read error — covering the race where the IP is already released but the lifecycle state has not flipped yet.No schema changes; behavior for live mount targets is unchanged.
Verification
Same reproduction with the patched provider (
dev_overrides):Refresh converges cleanly (resource reported deleted and removed), and a subsequent
destroycompletes. Package builds and vets clean.🤖 Generated with Claude Code