Back to Terraform

OCI Identity Deep Dive: Dynamic Groups, Resource Principals and OKE Workloads

November 6, 2026 Wasil Zafar 34 min read

Separate instance/resource principals from OKE workload identity through a controlled provider-specific rehearsal

Table of Contents

  1. Identify Which Principal Model the Workload Actually Uses
  2. Map Compartment and Policy Evaluation
  3. Verify Feature and SDK or Provider Prerequisites
  4. Test a Narrow Grant and a Denied Operation
  5. Document Rotation and Recovery Owners

Identify Which Principal Model the Workload Actually Uses

Four principal names cover every caller this page tests, and one of them is routinely misread. A user, a compute instance, a platform resource such as a function, and an OKE workload. The node is not a fifth name: it is an instance principal that happens to host pods, which is exactly why pod permissions leak onto it.

The node is an instance principal

A pod has no identity of its own unless you attach a workload principal. The node signs as an instance, so every process on it can inherit that grant; keep node permissions to image pull and give application data to the workload identity.

A user principal is the only one that carries a durable secret. The caller proves identity with an API key pair or a one-hour security token, and a group membership decides what the resulting session may do. That key survives the laptop, the ticket and the contractor, so rotation is a calendar event with a human owner rather than a platform behaviour.

An instance principal is the instance, not the process. The certificate comes from the instance metadata service, IAM resolves the instance through a matching rule, and Oracle states plainly that anyone who can access the instance inherits its privileges. Every pod on that node can sign as the instance, because the pod is a process on the same machine.

The instance starts with one grant nobody can remove. Oracle documents that every compute instance principal receives a compartment-inspect permission that lists compartments, their descriptions and their free-form tags across the tenancy. It cannot be revoked, so "no permissions yet" is not a state a node can actually be in.

A resource principal narrows the same machinery to one platform resource. Functions inject a session token and a private key into the execution environment, and the matching rule names a resource type or a resource OCID rather than an instance. The token is valid only for the resources the group was granted, so the blast radius is the function instead of the host.

OKE workload identity is not a dynamic group at all. The identity is the triple of cluster, namespace and service account, and the documented policy subject is any-user with four request conditions. Oracle states that workload identities cannot currently be used with dynamic groups, so no matching rule will ever make one a member.

The operational difference is who chooses the identity. A process cannot decide to be a different instance, and a function cannot decide to be a different resource. A pod can choose a service account by mounting that account's token, which makes the workload manifest part of the authorization decision.

Enhanced cluster is a gate, not a setting. Workload identity exists only on enhanced clusters, and an enhanced cluster must be VCN-native when it is created. A basic cluster built with a public endpoint has no upgrade path, so a lab assembled the old way cannot test this principal at all.

Identify Which Principal Model the Workload Actually Uses
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','signalColor':'#5a6e82','noteBkgColor':'#c4873b','noteTextColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    R["Code that calls OCI
a terminal, a job or a pod"] --> W{"Where does it run?"} W -->|"a laptop or CI"| U["User principal
API key or security token"] W -->|"a compute instance"| I["Instance principal
certificate from the metadata service"] W -->|"Functions or Data Flow"| P["Resource principal
injected token and private key"] W -->|"an OKE pod"| E{"Enhanced cluster?"} E -->|"no"| X0["No workload identity
the pod can only borrow the node"] E -->|"yes"| K["Workload identity
cluster, namespace, service account"] U --> G["Group membership
named by a policy"] I --> G P --> G K --> A["any-user statement
with request conditions"] G --> D{"Verb and location
granted?"} A --> D D -->|"no"| X1["404 NotAuthorizedOrNotFound
existence hidden on purpose"] D -->|"yes"| Y["Call allowed
Audit records the principal"] I -.->|"inherited by every pod"| X2["Node grant reaches
the whole instance"] K -.->|"not a group member"| X3["Workload identities
cannot join a dynamic group"] classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class R primary; class W,E,D warn; class U,I,P secondary; class G,A,K,Y ok; class X0,X1,X2,X3 danger;

Figure 1 asks where the code runs before it asks what permission it needs. The first branch that matters is the third row: a function and an instance share the dynamic-group mechanism but not the scope, and a pod is the one caller that bypasses that mechanism entirely.

Four principal models and the scope each one hands to a single grant Four lanes. The user principal authenticates with a durable key and is matched by group membership. The instance principal authenticates with a certificate from the instance metadata service and is matched by a dynamic group rule, so every pod on the node shares it. The resource principal authenticates with an injected session token and private key and is matched by a rule on the resource type or OCID. The workload principal is the triple of cluster, namespace and service account and is matched by request conditions in an any-user statement. A crimson footer states that every pod that reaches the metadata service signs as the instance, and a navy footer states that naming two of the three workload conditions grants nothing. Four lanes, four scopes, one shared instance An administrator matches the first three. The pod chooses the fourth by mounting a token. USER PRINCIPAL A person or a job API key or token Group membership grant outlives the job Rotation is a human event. The key outlives the ticket. Kept for the console and the first bootstrap run. INSTANCE PRINCIPAL The compute instance certificate from IMDS A matching rule compartment, OCID or tag Every pod can reach it. One grant, whole node. Certificates rotate often. One list is unavoidable. RESOURCE PRINCIPAL One platform resource injected token and key A matching rule resource type or OCID Blast radius is the function. The token is cached briefly. Rule variables are not the instance ones. OKE WORKLOAD Cluster plus namespace plus service account Policy conditions no dynamic group Enhanced clusters only. Chosen by the pod spec. A typo in one value fails without naming it. Anything that can reach the instance metadata service signs as the instance, including every pod. The workload identity is a triple. A statement that names two of the three conditions grants nothing. Scope is set by the object that is matched, not by the name of the policy.

Figure 2 puts the four lanes beside the scope each one hands to a single statement. The user lane is the only one where a credential can be copied. The instance lane is the only one where a grant is shared by processes the grant author never considered.

PrincipalAuthenticates withMatched byPolicy subjectOne grant reaches
Usera password plus MFA, or an API keygroup membershipgroupevery resource the group can reach
Instancea certificate from the metadata servicedynamic group ruledynamic-groupevery process and pod on that instance
Resourcean injected session token and private keydynamic group rule on the resourcedynamic-groupone function, or one compartment of functions
Workloada projected service account token, exchanged by an SDKcluster, namespace and service accountany-user with conditionsone workload, one call at a time

The table is a revocation map, not a naming guide. Removing a person from a group, deleting an API key, rewriting a matching rule and editing a workload condition are four different operations performed by four different owners. A runbook that says "rotate the credential" for all four is wrong in three of the rows.

Two principals can be legitimate at the same time. A controller inside a pod may use workload identity while the kubelet on the same node uses the instance principal to pull images. The design is sound; the failure is letting the second one cover for the first when a workload policy is wrong.

Write the principal into the ticket before the grant. A request that says "give the app read access" is unanswerable, because the answer changes the object you create and the owner who can revoke it. A request that names the model, the compartment and the target is a policy statement waiting for a reviewer.

Map Compartment and Policy Evaluation

A policy is evaluated at the resource, not at the caller. The statement's location clause must contain the compartment where the target lives; where the principal was created is irrelevant. A dynamic group is a tenancy-level object and can still be granted one verb in one child compartment.

Attachment decides inheritance, and the direction is downward only. A policy attached to a compartment applies to that compartment and its descendants. A statement inside it may name a deeper path such as platform:app-prod, but nothing a child policy says can widen the parent, and no statement narrows a broader one.

Verbs are a ladder, and the rungs are not synonyms. Inspect lists resources and metadata; read adds their content; use adds working with existing resources; manage adds create, delete and permission changes. A "read-only" grant written with inspect returns a list and then fails the call the application actually makes.

Inspect is not read

Inspect lists resources and metadata; read adds content; use adds working with existing resources. A verb chosen one rung too low passes the console check and fails the application, so test the real call.

There is no deny statement anywhere in the language. The implicit deny applies only to what no statement grants. A tenancy-wide manage statement cannot be corrected by a later, narrower statement; the only fix is to remove or replace the broad one, which makes every wildcard a decision that needs a named owner.

A matching rule is membership, and membership is not authorization. The rule compiles to a set of resources, and the policy decides what that set may do. A principal that matches a rule but is named by no statement behaves exactly like a principal that matches nothing, including the same 404 response.

A rule that matches one node pool has to use a tag, because a compartment is too coarse. A pool's defined tags propagate to its instances, so ALL {instance.compartment.id = '<compartment-ocid>', tag.ops.pool.value = 'oke-nodes'} selects that pool and leaves the rest of the compartment outside the group. Rules combine into one set, so a second rule can silently undo the narrowness of the first.

A function rule selects the resource type before the OCID. ALL {resource.type = 'fnfunc', resource.compartment.id = '<compartment-ocid>'} covers every function in that compartment, which suits a shared automation library and is too broad for one privileged job. Narrow it to resource.id when the function's authority is not shared with its neighbours.

An exclusion is written inside the rule, not in the policy. ALL {instance.compartment.id = '<compartment-ocid>', instance.id != '<instance-ocid>'} removes one host from an otherwise compartment-wide group, and it is the only supported way to subtract. A policy cannot subtract at all, so the rule is the last point where a narrower set is still possible.

Rule syntax is checked when you save it; the OCIDs are not. A mistyped compartment OCID produces a valid rule that matches no resource. The symptom arrives an hour later as an authorization failure, and the natural response — widen the policy — makes the real defect permanent.

Matching variables are not interchangeable between principal kinds. Instance rules use an instance prefix and resource rules use a resource prefix, so instance.compartment.id and resource.compartment.id are different tests even though they read alike. A function's group written with the instance form is syntactically fine and matches nothing.

A resource rule can select by defined tag, not by free-form tag. Oracle documents that free-form tags are not supported in that rule form, so a lab that tags a function with a free-form label and expects the group to fill will wait forever. Use a defined tag namespace or the resource OCID.

The workload statement has no subject keyword. The documented form is any-user plus conditions on principal type, namespace, service account and cluster OCID, so that condition list is the entire boundary. Omit the principal-type condition and the statement grants every user in the tenancy the verb, which is the single most expensive typo in this model.

A typo in a workload condition fails silently at the policy layer. IAM stores the strings; it does not confirm that the namespace or the service account exists. The plan succeeds, the policy is accepted, and the pod fails at token exchange with a message that rarely names the mismatched value.

Cross-compartment access needs a workload mapping before the policy matters. A mapping binds a namespace on a cluster to a target compartment, and it is namespace-wide, so service-account conditions do the finer scoping inside it. Creating one requires the bind permission in the target compartment as well as manage on the mappings in the cluster's compartment.

Attachment is the administration boundary. Anyone with manage policies where a policy is attached can rewrite every statement in it, including statements about compartments below. That is why the grant that lets a pipeline change infrastructure should not sit in the same attachment as the grant that lets it change policy.

Map Compartment and Policy Evaluation
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','signalColor':'#5a6e82','noteBkgColor':'#c4873b','noteTextColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    Q["Signed request
or bearer token"] --> P{"Principal resolved?"} P -->|"signature or token rejected"| E1["401 NotAuthenticated
a credential problem"] P -->|"a user"| UG["Group membership
domain plus name"] P -->|"an instance or a resource"| MG{"Dynamic group
matching rule"} P -->|"an OKE workload"| WL{"Cluster, namespace
and service account"} MG -->|"rule matches"| ST["Statement in the resource
compartment chain"] MG -->|"not yet, up to one hour"| E2["404 NotAuthorizedOrNotFound
principal unknown"] WL -->|"conditions hold"| ST WL -->|"no mapping or a typo"| E3["404 NotAuthorizedOrNotFound
triple not recognised"] UG --> ST ST --> V{"Verb covers
the operation?"} V -->|"no"| E4["404 NotAuthorizedOrNotFound
inspect is not read"] V -->|"yes"| C{"Target and request
conditions hold?"} C -->|"no"| E5["404 NotAuthorizedOrNotFound
condition mismatch"] C -->|"yes"| OK["Allowed
Audit records principalId"] ST -.->|"attached higher"| INH["Children inherit
never the parent"] classDef primary fill:#132440,color:#ffffff,stroke:#0b172b; classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a; classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f; classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420; classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f; class Q,ST primary; class P,MG,WL,V,C warn; class UG,OK,INH secondary; class E1,E2,E3,E4,E5 danger;

Figure 3 separates the four ways a well-formed request still fails. A 401 means the credential was not accepted and belongs to the principal owner. Every 404 in the diagram means the credential was fine and an authorization fact was missing, which is why the responder differs at each branch.

The slow branch is the one that gets misdiagnosed. A newly launched instance is a stranger for up to an hour after a rule change, and during that hour every call looks like a policy error. Record the rule change time in the incident, then wait rather than widening the statement.

A named group and a group OCID are the same object only while the group exists. Delete a dynamic group and recreate it with the same name and you have a different principal with a different OCID, while the policy text still reads as if nothing changed. That is the concrete mechanism behind "do not derive permissions from a similarly named identity."

Verify Feature and SDK or Provider Prerequisites

Pin both versions before you debug a principal. This page is written against Terraform 1.17.1 and provider oracle/oci 9.12.1, and a floating provider range can move the authentication surface between runs. A provider upgrade changes the hand-off more often than it changes any single resource argument.

The provider selects the model with one argument, and the argument is not evidence. Setting the auth mode to an instance or workload value removes the tenancy, user and key fields, which is convenient and also hides a wrong choice. Terraform will happily plan with a principal that cannot do anything, because the mode is a string and the identity is resolved at request time.

Instance principal mode still needs a region. The instance supplies a certificate, not an endpoint, so the provider block or the environment must say which region to call. Omitting it produces a configuration error that reads like a missing credential.

Resource principal mode reads four environment values that the platform injects. The version marker, the session token path, the private key path and the region are set by Functions, and the provider consumes them without any credential attribute in the block. Since provider 5.0.0 a region in the block overrides the injected one, which is a deliberate feature and an easy way to point a function at the wrong region.

Workload identity mode has no credential fields at all. The pod mounts a projected service account token, the provider exchanges it, and the plan file therefore contains no key material. That property is the strongest argument for the model, and it depends entirely on the pod spec mounting the token in the first place.

The exchange is an SDK feature with a version floor. Python needs 2.111.0 or later and Go needs 65.32.0 or later; an older client has no workload identity provider, so the failure is a missing class rather than a denied call. Java splits the floor between its legacy and standard lines, and .NET and Ruby carry equivalent minimums.

Oracle documents the supported path as an OCI SDK, and states that the console and the API are not supported for this principal. That rules out the usual probe, so the honest proof is the application's own client, or the Terraform provider running with the workload identity mode. Either way the token is exchanged in the container, which is where the policy conditions are finally tested.

An enhanced cluster is the first hard gate, and it is a create-time decision. Workload identity needs enhanced, enhanced needs a VCN-native endpoint, and a basic cluster built the older way cannot be upgraded into that shape. Check the cluster type in state before writing a single policy for a workload.

The namespace and service account are Kubernetes objects, not OCI resources. Terraform can create them through the Kubernetes provider, but the OCI policy cannot depend on them and IAM will not validate them. That missing edge is why the policy can be planned before the workload exists, and why the first sign of a mistake is a running pod.

Four facts can only be checked at runtime, and all four belong in the lab plan. Whether the namespace and service account exist, whether the image contains a client that can perform the exchange, whether the triple in the policy matches the triple the pod presents, and whether the denied call is actually denied. Everything else — provider version, auth mode, cluster type, policy syntax — is visible before the apply.

Six prerequisite gates, split between what a plan can prove and what only a runtime exchange can prove A vertical chain of six gates: pinned Terraform and provider versions, an explicit authentication mode, an enhanced VCN-native cluster, a namespace and service account, a client that supports the token exchange, and a pair of allowed and denied calls. A navy panel lists the facts visible at plan time, including provider version, auth mode, cluster type and policy syntax. An amber panel lists the facts only proven at runtime, including whether the namespace and service account exist, whether the image supports the exchange, whether the condition triple matches, and whether the denied call is denied. A crimson footer states that a basic cluster has no upgrade path to workload identity, and an amber footer states that a policy does not check that the namespace exists. Six gates, and four facts that need a run The provider can prove version, mode and schema. Only the exchange proves the identity. 1. Versions pinned Terraform 1.17.1 and oracle/oci 9.12.1 resolve exactly 2. Auth mode chosen APIKey, InstancePrincipal, ResourcePrincipal or OKEWorkloadIdentity 3. Cluster type and network enhanced, and VCN-native since the first apply 4. Namespace and service account Kubernetes objects that IAM cannot see or check 5. Client supports the exchange an SDK version floor, baked into the image 6. One allowed and one denied call recorded as evidence, not inferred from a plan VISIBLE IN THE PLAN the provider version that resolved the auth string in the block the cluster type in state the policy text as accepted ONLY PROVEN AT RUNTIME that the namespace and service account exist that the image can perform the exchange that the triple matches the policy that the denied call is denied A basic cluster has no path to workload identity. The type is settled at create time. A policy does not check that the namespace exists. A typo plans cleanly and fails in the pod.

Figure 4 splits the gates into what a reviewer can settle in a pull request and what only a run can settle. The left column is a short checklist; the right column is the reason the lab ends with eight recorded calls instead of a green plan.

Pin the provider and then prove the pin. A version constraint of ~> 9.12 is a range, and a lock file is the only record of what actually ran. Read the resolved version from the lock file, not from the constraint, when you attach evidence to the change.

Treat the cluster type as an input contract. If the workload root receives a cluster OCID without the enhanced property, every other gate is wasted effort. Publish the type as an output from the cluster root and assert it in the workload root, so a wrong cluster reference fails before the policy is written.

Test a Narrow Grant and a Denied Operation

The test is four pairs, not four probes. Each principal gets one allowed call and one denied call, and each pair isolates a different variable: the verb, the target, the location, and the condition triple. Four successes would prove almost nothing; the denials are what pin the boundary.

Build the denial first. A grant you cannot deny is a grant you do not understand, and a denial that arrives as a 401 means you tested the credential instead of the policy. Write the expected status for both calls before either is run.

The user pair proves the verb ladder. The group holds read on buckets in app-prod, which is enough to list them. Listing succeeds; attempting to create a bucket returns the not-authorized family, because create needs manage and no second statement adds it. That is the same principal, the same compartment and a different verb.

The instance pair proves the node cannot read workload data. The node's dynamic group holds read on container repositories, which is enough to pull an image. Pulling one image by digest succeeds, and reading an object from the workload bucket is denied in the same compartment. This is the pair that proves the node grant was not quietly widened to cover the application.

The resource pair proves location. The function's matching rule selects one resource type in its own compartment, and its policy grants bundle reads in app-vault for one secret. Reading that secret succeeds; the same call against a secret in app-finance fails on location, with the verb and the resource type unchanged.

The workload pair proves the triple. The pod lists objects in app-prod with the granted service account and succeeds. A second pod in the same namespace, running the same image with a different service account, makes the identical call and is denied. Nothing about the network, the image or the region changed.

Run the workload denial as a namespace swap too, once. The same service account name in a second namespace is the closest thing to a copy of the identity that Kubernetes can produce, and it must fail. If it succeeds, the policy is missing the namespace condition and is granting more than one workload.

A denial is only evidence when the credential is good. The 404 family means the caller authenticated and the authorization fact was missing; a 401 means the certificate, token or signature was rejected. Record the class, not just "failed", because the two send the investigation to different owners.

Read the target condition test in the right direction. A denial on a second bucket in the same compartment proves the condition is doing work. A denial on a bucket in another compartment proves only that the location clause is narrow, and those are different guarantees.

Never derive a grant from a name. A dynamic group called for workloads, a service account called for workloads and a policy condition called for workloads are three unrelated objects. Only the condition triple authorizes a pod, and only the matching rule authorizes a resource.

Repeat the denied call after every rule change. The rule window is about an hour, and the function token is cached for fifteen minutes, so a denial taken immediately after an edit may be a stale success. Time-stamp the rule change and the evidence line together.

The node test is the one reviewers skip. A workload policy can be perfect while the node holds the same permission for an unrelated reason, and the pod will still work when the workload policy is removed. Only a denied call from the node itself distinguishes the two.

Keep the node grant to what the kubelet needs. Image pull, volume attach and node lifecycle are instance-level concerns; bucket reads, secret reads and queue writes are workload concerns. Anything from the second list that appears in a matching rule has been given to every pod on the node, including the one that mounts no service account. On a basic cluster, where workload identity does not exist, that separation is the only control available.

Four principals, four dimensions, eight recorded results A four-row matrix. The user row allows listing buckets in the application compartment and denies creating one, proving the verb ladder. The instance row allows pulling one image by digest through a repository grant and denies reading an object in the workload bucket, proving that a node grant does not reach application data. The resource row allows reading one secret in the vault compartment and denies reading a secret in a sibling compartment, proving the location clause. The workload row allows listing objects with the granted service account and denies the same call from a different service account in the same namespace, proving the condition triple. A crimson footer states that the instance grant is shared by every pod on the node, and a navy footer states that evidence records the OCID suffix and the status class. Four principals, four dimensions, eight results Each row isolates one variable. The denial is the evidence. PRINCIPAL ALLOWED CALL DENIED CALL User durable key list buckets in app-prod granted by read on buckets create a bucket there manage is missing, verb denied Instance the node itself pull an image by digest granted by read on repositories read an object in the bucket no object grant, isolation proof Resource one function read one secret in app-vault granted by target.secret.id read a secret in app-finance location outside the statement Workload one pod identity list objects in app-prod granted by the full triple same call, other service account triple mismatch, same namespace The instance grant is shared by every pod on the node. Row two is the isolation proof. Evidence keeps the OCID suffix, the status class and the time. Never the full response.

Figure 5 is the acceptance sheet for this deep dive. Working down the rows moves the variable from the verb, to the target condition, to the location, to the identity triple, which is the order in which a broken grant usually fails.

Record the pair, not the success. An evidence line that says "the workload could read the bucket" cannot be reviewed. A line that names the allowed call, the denied call, the status class and the time can be reproduced by someone who was not in the room.

Clean up the principals, not just the resources. A lab that deletes the cluster but leaves four dynamic groups and three policies has left standing authority with no owner. The teardown order is workload objects, then policy statements, then dynamic groups, then the cluster and network.

Document Rotation and Recovery Owners

Authorization has a lifecycle even when the credential does not. Instance certificates rotate several times a day without an operator, while an API key sits unchanged until a person remembers it. A design that documents only the credential describes half the lifecycle and none of the revocation.

Rotation and revocation are different operations. Issuing a second key does not remove the first, and restarting a pod does not remove a grant. Revocation is the act that removes a principal from a group, deletes a key, edits a condition or deletes a policy, and it needs a named owner who can perform it at three in the morning.

The revocation clock decides the incident note. A user group change takes effect on the next call; a dynamic group rule takes about an hour; a function's resource token is cached for fifteen minutes; a workload is re-evaluated at its next token exchange. Quote the slowest one for the principal involved, not the fastest one in the table.

Name an owner per principal, not per environment. The person who can edit the matching rule is usually not the person who can edit the policy, and neither may be able to create the cluster. Splitting the owners is a control; documenting it as one team is how the control disappears in a reorganisation.

The recovery path must be narrower than the incident it answers. A break-glass group with a broad grant is acceptable when its membership is empty in steady state and its use is logged. A permanent second key for the same user is not a recovery path; it is the incident waiting to happen.

Deleting a dynamic group is not a rename. The name must be unique across all groups and dynamic groups in the tenancy, the OCID changes on recreation, and the group cannot be deleted while it still has members. A recovery runbook that recreates a group by name leaves every policy pointing at the old OCID.

Write the stale window into the runbook beside the revocation step. "Remove from the group, then expect up to one hour" is an operationally honest instruction. "Remove from the group" alone produces a second incident in which the grant appears not to have been removed.

Lab

Document Rotation and Recovery Owners

Status: design-only. No Oracle Cloud tenancy, credential or billable resource was used, and none of these steps was executed. The versions are Terraform 1.17.1 and provider oracle/oci 9.12.1; every identifier is a placeholder you supply from a disposable compartment.

Prerequisites. One sandbox tenancy with an identity domain you administer, four compartments you own, an enhanced VCN-native cluster, one function, one bucket, one vault secret, and a group that can read policies but not edit them. Cost stays near zero if the cluster is destroyed the same day.

PrincipalWhat rotatesRevoke byStale windowEvidence to keep
UserAPI key, and a token that expires hourlydelete the key, remove the group membershipnext callkey fingerprint and the denied call after removal
Instancecertificate from the metadata servicechange the matching rule or remove the instanceabout one hourrule text, change time, denied call from the node
Resourceinjected token and private keychange the rule or the policyfifteen-minute token cachefunction OCID suffix and the denied secret read
Workloadprojected service account tokenedit the condition or delete the policynext token exchangetriple, plus the denied call from the second account
  1. Write the four principals and their owners into one table before creating anything; leave a row empty and you have found the object nobody will revoke.
  2. Record the current time, then change one matching rule by adding an exclusion for a single instance OCID.
  3. Immediately run the allowed call from the excluded instance and expect it to still succeed; this is the propagation window, not a policy error.
  4. Repeat the call after the documented window and expect the denial, then restore the rule and record the second time.
  5. Delete a user API key and repeat the user's allowed call; expect a credential failure rather than an authorization denial.
  6. Read the function's secret with the resource principal, then edit the policy to a sibling compartment and repeat within the token cache; expect the old result until the cache expires.
  7. Change one workload condition, such as the service account, and repeat the allowed call from the pod; expect a denial at the next exchange rather than at pod restart.
  8. Attempt to delete the dynamic group while it still matches resources; expect a refusal, which is the reason a "recreate by name" recovery step fails.
  9. Sanitize the evidence: keep the rule text, the condition triple, the timestamps and the status classes; delete plan files, local state and any token copied into a note.

Expected observation. Each revocation lands at its own clock, in the order listed in the table, and the earliest change is not the fastest visible one. The excluded instance keeps working for a while, the token-bearing function keeps working for minutes, and the pod fails only when it asks for a new token.

Failure checks. The lab fails if the excluded instance never loses access after the window, which usually means a second rule still matches it; if the deleted key still works, which means a duplicate key exists; if the workload denial appears only after a pod restart, which suggests the policy was cached by the application rather than re-exchanged; or if the group deletion succeeds while members remain, which means the rule changed since you last looked.

Cleanup. Delete workload objects, then the policy statements, then the dynamic groups, then the function and cluster, then the compartments. Confirm each group is empty before deletion, and confirm the policies that named it are gone rather than repointed.

Evidence to keep. One row per principal with the artifact, the revocation action, the measured stale window and one denied call taken after the change. A reviewer should be able to reconstruct the whole lifecycle from those four rows without seeing a private key, a token or a full OCID.

What survives this page is the separation, not the lab. The verb ladder, the matching-rule variables, the location clause and the workload triple are the same in every tenancy. The compartments and clusters are the parts you can rebuild.