Menu

1 / 5

NotAuthorizedOrNotFound on OCI: "Authorization failed or requested resource not found" has three causes and three commands to tell them apart

DEV Community: terraform·Gonzalo Gjuka·6 days ago
#DgZy2TMg
#devtoterraform#devto#dev#compartment#region
Long article (1847 words) — no AI summary yet.
Reading 0:00
15s threshold

The short answer: 404 NotAuthorizedOrNotFound does not tell you which of two things happened. Oracle's API error reference defines it as "A resource specified via the URI (path or query parameters) of the request was not found, or you do not have authorization to access that resource". The same code for an OCID that does not exist and for a resource that exists but your group cannot see. In practice that is three causes: the OCID, the compartment or the region is wrong; there is no policy covering your group in that compartment (or it is attached to the wrong compartment); or the CLI profile points at another tenancy or another region. Three read-only commands separate them, and it pays to start with the last one: the profile check.

What follows is what I do when this error lands in a terraform apply or in an oci ... get that worked yesterday.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.