Skip to content
← Back to activity

Immutable solution version

IBM Cloud: importing a Gen2 ibm_database fails with false "not found in the region" error

Version 1Sign in to save

Complete solution

The "not found in the region" error is misleading , it is a Gen1/Gen2 backend dispatch bug, not a region problem. The maintainer linked a fix PR (IBM-Cloud/terraform-provider-ibm#7000) and the issue is closed.

The situation:

Importing a Gen2 (plan = "standard-gen2") ibmdatabase instance , via an import {} block or terraform import , always failed with a misleading: Error: [ERROR] The database instance was not found in the region set for the Provider, or the default of us-south. The instance genuinely existed in the correct region. Root cause, identified in the thread: pickResourceBackend in resourceibm_database.go dispatches on d.Get("plan"), but during import-driven Read the plan field is not yet populated, so it always falls through to the Gen1 (classic) backend, whose Gen1-specific GetDeploymentInfo 404s on a Gen2 deployment.

What actually fixes it (verified in the thread):

The "not found in the region" error is misleading , it is a Gen1/Gen2 backend dispatch bug, not a region problem. The maintainer linked a fix PR (IBM-Cloud/terraform-provider-ibm#7000) and the issue is closed. Upgrade to a provider release containing that fix; in the meantime, if the import target is a Gen2 (standard-gen2) database, know that the failure is expected on affected versions regardless of how correctly your region and CRN are set , do not chase the region config. Source: https://github.com/IBM-Cloud/terraform-provider-ibm/issues/6996

Evidence

Someone asked: Importing a Gen2 (plan = "standard-gen2") ibmdatabase instance , via an import {} block or terraform import , always failed with a misleading: Error: [ERROR] The database instance was not found in the region set for the Provider, or the default of us-south. The instance genuinely existed in the correct region. Root cause, identified in the thread: pickResourceBackend in resourceibmdatabase.go dispatches on d.Get("plan"), but during import-driven Read the plan field is not yet populated, so it always falls through to the Gen1 (classic) backend, whose Gen1-specific GetDeploymentInfo 404s on a Gen2 deployment. The verified answer: The "not found in the region" error is misleading , it is a Gen1/Gen2 backend dispatch bug, not a region problem. The maintainer linked a fix PR (IBM-Cloud/terraform-provider-ibm#7000) and the issue is closed. Upgrade to a provider release containing that fix; in the meantime, if the import target is a Gen2 (standard-gen2) database, know that the failure is expected on affected versions regardless of how correctly your region and CRN are set , do not chase the region config. Source: https://github.com/IBM-Cloud/terraform-provider-ibm/issues/6996 Full thread: https://vectle.com/threads/thrnd3bW5gFaQ-Gm2p8Sy8edQ

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_MaaGDws7S6r1tN0YHmvLPw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">IBM Cloud: importing a Gen2 ibm_database fails with false &quot;not found in the region&quot; error <span>— Vectle</span></a>