Back to Terraform

OCI Compute: Shapes, Availability Domains, VNICs and Load-Balancer Health

November 6, 2026 Wasil Zafar 35 min read

Provision compute capacity with explicit image/shape choices and verified application readiness

Table of Contents

  1. Verify Shape, Image and Domain Availability
  2. Model Instance, VNIC and Boot/Data Volumes Deliberately
  3. Connect Instance Principal and Bootstrap Without Leaking Keys
  4. Define Load-Balancer Backend and Health Contracts
  5. Measure a Change and Audit Remaining Volumes and IPs

Verify Shape, Image and Domain Availability

A shape is a contract between an image and a host. The image supplies the boot loader, the kernel and the architecture; the shape supplies the CPU family, the memory range and the maximum number of VNICs. Neither one is valid on its own, and the pairing is narrower than either catalog suggests.

An image is regional, so a second region is a second artifact. Custom images do not follow a configuration across regions, and a plan that names an image OCID from the wrong region fails at launch rather than at plan. Treat the image as a build output with a region, a build reference and an OCID, and copy it before the second region enters the configuration.

Compatibility is a query, not a recollection. The image shape listing returns the shapes an image supports together with the OCPU and memory bounds for each pair, which is the only trustworthy answer after a platform image refresh. Query it with the image OCID you intend to boot, not with the image family name.

Flexible shapes move the decision from the catalog into the arguments. An OCPU count and a memory size replace a fixed instance size, and both must sit inside the shape's own range and the image's narrower range. The memory argument is a total, but the bound is per OCPU, so two OCPUs with 128 GB is a very different claim from four OCPUs with the same total.

The ratio is the part people get wrong. A shape that allows a wide memory band per OCPU accepts a small instance and a very large one, and the same total memory at a lower OCPU count produces a memory-bound instance that boots and then swaps. Pick the OCPU count from the workload and let memory follow the ratio you actually need.

Availability domain names are data, not constants. The identity listing returns names such as a region code followed by an AD ordinal, and the instance argument takes the name rather than the OCID. Hardcoding a name that a reader copies from a console screenshot pins the configuration to one region and one tenancy's view of it.

Each availability domain exposes three fault domains. A fault domain is a grouping of hardware inside one AD, so two instances in different fault domains of the same AD survive a hardware failure that would take both instances in one. Leaving the argument unset lets OCI place the instance, which is fine for one member and wrong for a pair.

Placement has two independent limits: stock and quota. Host capacity is a fact about a shape in an AD at a moment, and the account's service limit is a fact about the tenancy. Both surface as a failed launch, only one is fixed by a request, and the plan shows neither.

A capacity reservation is the only plan-time capacity fact. It reserves a count for a shape in a named availability domain, optionally pinned to a fault domain, and an instance that names it is no longer exposed to stock. Everything else is a preference expressed at apply time.

AssumptionVerified byFailure when unverified
The image boots this shapeimage shape compatibility listinglaunch rejected on architecture, or a kernel with no driver
The OCPU and memory pair is legalshape OCPU and memory options, narrowed by the imageapply rejected after the network and volumes exist
The AD offers the shape todayshape listing scoped to the ADout of capacity, midway through a rollout
The tenancy may launch itservice limit for the shape familya failure that retrying the same shape will not fix
The fault domain spread is realfault domain listing per ADtwo members on one rack, presented as resilient
Capacity exists for the surgecapacity reservation, or nothinga replacement that cannot start while the floor is held

Two members in two ADs is a regional claim; two members in one AD is a rack claim. A regional subnet lets a replacement land anywhere in the region, so a rollout inherits whatever spread the ADs give it. If the application needs the tighter claim, place the members in different fault domains explicitly and record which one each member occupies.

GPU and specialized shapes narrow the map further. Those families are offered in a subset of ADs and sometimes a subset of fault domains, and a configuration that treats them like general-purpose shapes discovers the gap when the first replacement is scheduled. Read the shape listing per AD before promising a second member.

Figure 1 follows one launch decision from the pinned image to the capacity answer.

Verify Shape, Image and Domain Availability
%%{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','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#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','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    IMG["Pinned image OCID
build reference and region"] --> COMPAT{"Image lists the shape
as compatible?"} COMPAT -- "no" --> X1["Launch rejected
architecture or driver mismatch"] COMPAT -- "yes" --> BOUNDS["Shape bounds and image bounds
OCPUs, memory per OCPU"] BOUNDS --> FIT{"Requested pair inside
both ranges?"} FIT -- "no" --> X2["Apply rejected
invalid shape configuration"] FIT -- "yes" --> ADS["Availability domains
names from the identity listing"] ADS --> STOCK{"Shape offered in the AD
and host capacity available?"} STOCK -- "no" --> X3["Out of capacity
after the network exists"] STOCK -- "yes" --> FD["Fault domain
explicit or assigned"] FD --> CAP{"Capacity reservation
names this shape?"} CAP -- "yes" --> OK["Capacity is a plan-time fact"] CAP -- "no" --> HOPE["Capacity is an apply-time hope"] 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 COMPAT,FIT,STOCK,CAP primary; class IMG,BOUNDS,ADS,FD secondary; class OK ok; class X1,X2,X3 danger; class HOPE warn;

The amber node is the normal case, not the exception. Most teams launch without a reservation and accept an apply-time capacity risk, which is a reasonable decision only when it is written down beside the rollout plan. The red branches are cheaper to find now than during a replacement.

Figure 2 draws the same decision as three boundaries, because the artifacts belong to different owners.

Three boundaries for one compute launch: an image build, a tenancy inventory and a runtime instance The build boundary produces a pinned image with a region and a build reference. The inventory boundary answers compatibility, availability domain names, fault domains and flexible OCPU and memory bounds. The runtime boundary consumes those answers in one instance with an optional capacity reservation, and nothing in it can create stock. One launch, three owners of the answer Build boundary Source commit recipe, agent, tags Image build outside Terraform Pinned image OCID, region, build ref No instance here. A failed build costs no capacity. Tenancy inventory Image shape compatibility shape plus OCPU and memory bounds Availability domains names, not OCIDs Fault domains three per availability domain Stock and service limits two different failures Runtime boundary oci_core_instance shape, AD name, image OCID subnet, fault domain shape_config OCPUs and memory in GB validated by the API, not the plan Capacity reservation count, shape, AD, fault domain optional, and the only guarantee The provider cannot create stock. A PASSING QUERY IS A SNAPSHOT, NOT A RESERVATION Record the query date beside the shape, and keep a second availability domain in the plan.

The three columns disagree about time. The image is a version that changes on a build, the inventory answers today's question, and the instance exists for as long as nobody replaces it. A release record that stores only the instance OCID cannot say which of the three moved.

Model Instance, VNIC and Boot/Data Volumes Deliberately

One instance resource contains a network attachment, an address plan and a disk. The primary VNIC, its private address and the boot volume are created as part of the launch, so a change to any of them is a change to the instance's arguments even when the object that changes is not the instance. The subnet and NSG come from the network stack, and this stack should receive them as inputs rather than re-declare them.

Subnet membership is a replacement; security membership is an edit. Changing the subnet or pinning a different private address destroys and recreates the instance, while changing the NSG list or the public-IP flag updates the VNIC in place. The plan distinguishes the two with a replacement marker, and a review that skips it mistakes an outage for a config tweak.

A pinned private address is a promise the instance cannot keep by itself. The address is available only while nothing else holds it, and a replacement that recreates the VNIC from the same argument usually gets the same address back, but only after the old one is released. That ordering is why a replacement can fail on an address conflict that the plan never showed.

Additional VNICs are their own objects with their own lifecycle. A secondary attachment is created against a running instance and destroyed before it, and its address is not part of the instance's export. A stack that destroys the instance first leaves the attachment to fail, and one that creates the attachment before the instance has no target.

The primary VNIC has an address the balancer will name. The backend list holds an address, not an instance OCID, so a replacement that changes the private address leaves a backend pointing at a host that no longer exists. Pin the address when a backend registration has to survive a replacement, and accept the conflict risk that comes with the pin.

A public address has two completely different lifetimes. An ephemeral address is assigned at launch and dies with the VNIC, while a reserved address is a separate object that outlives the instance and keeps billing until it is released. The second kind is what a DNS record should point at, and the same property is why it appears in a teardown audit.

The boot volume is a copy of the image at launch, not a reference to it. Boot volume size comes from the launch arguments and is bounded below by both the image and the service minimum, so a larger image silently raises the floor for every instance built from it.

Changing the image is a boot volume swap, not a new instance. The provider updates the source and the boot volume is replaced underneath, keeping the instance OCID and the private address while discarding anything written to the system disk. That is a release with data loss, and the plan renders it as a single update line.

The old boot volume survives only if you ask for it. A preservation flag keeps the replaced volume instead of deleting it, which is the right choice for a forensic copy and the wrong choice for a routine rollout, because a preserved volume bills and appears in no instance listing.

Data volumes are separate resources in the same availability domain. A block volume is created in one AD and can attach only to an instance in that AD, so the volume's placement argument is a second copy of the instance's placement decision. A mismatch is rejected at attach time, after both objects exist.

Attachment type decides what the guest sees. A paravirtualized attachment presents a device the image can mount without extra tooling, while an iSCSI attachment needs the guest to log in to a target before the device appears. Choose per image, not per habit, and record the device name the application expects.

ChangePlan showsInstance identityVolumesEvidence to collect
NSG list on the primary VNICupdatekept, address keptunchangedrule listing and a probe from the balancer
Public IP flagupdatekept, address changes typeunchangedaddress inventory before and after
Subnet or pinned private addressreplacementnew OCID, new addressboot volume new, data volumes detached firstbackend registration timeline
Image sourceupdatekept, same addressboot volume replacedboot log naming the new build
OCPU or memory in shape configupdate with restartkept, address keptunchangeduptime gap and the new shape read back
Data volume attachmentcreatekeptnew device in the guestdevice name and mount
Preservation flag on the boot volumeupdatekeptold volume retained and billedvolume inventory after teardown

Replacement behavior is a provider fact, not a service fact. This article targets Terraform 1.17.1 and oracle/oci 9.12.1, where the subnet and the pinned address force replacement while NSG membership and the public-IP flag update the VNIC. Re-read those four fields after a provider upgrade, because a schema change moves the line between an edit and an outage.

Resizing is a restart, and the plan does not say so. A shape or shape configuration change is accepted as an in-place update and the instance restarts to apply it, which is a short outage that a plan summary renders as one changed line. Treat it as a change window with a health check before and after.

Replacement ordering is a graph question. A data volume attachment must be destroyed before the volume, the volume before the instance that no longer needs it, and a secondary VNIC before the instance it is attached to. Reference resources rather than literal OCIDs so the graph can order them, and read the destroy plan before accepting it.

Figure 3 follows one instance through the attachments, with the branches that turn an edit into a replacement.

Model Instance, VNIC and Boot/Data Volumes Deliberately
%%{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','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#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','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    I["Instance launch
shape, AD, image"] --> V["Primary VNIC
subnet and private address"] V --> SUB{"Subnet or pinned
address changed?"} SUB -- "yes" --> R1["Destroy and create
new address"] SUB -- "no" --> EDIT["NSG or public IP changed
VNIC updated in place"] I --> SEC["Secondary VNIC
separate attachment resource"] I --> BV["Boot volume
from the image at launch"] BV --> IMG{"Image source changed?"} IMG -- "yes" --> SWAP["Boot volume replaced
instance OCID kept"] IMG -- "no" --> KEEP["Boot volume kept"] I --> DV["Data volume
own resource, own AD"] DV --> AD{"Volume AD matches
the instance AD?"} AD -- "no" --> R2["Attach rejected
both objects already exist"] AD -- "yes" --> ATT["Attachment
device appears in the guest"] SWAP -.-> P1["Old boot volume deleted
unless preservation is set"] R1 -.-> P2["Backend still names
the old address"] SEC -.-> P3["Destroyed after
the instance, not before"] 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 SUB,IMG,AD primary; class I,V,SEC,BV,DV,EDIT,KEEP secondary; class SWAP,ATT ok; class R1,R2 danger; class P1,P2,P3 warn;

The dashed branches are the ones a plan does not announce. A backend that keeps an old address, a secondary attachment destroyed in the wrong order, and a preserved volume that outlives its instance are all consequences of a change that looked local.

Connect Instance Principal and Bootstrap Without Leaking Keys

Three versions move independently: the image, the bootstrap and the artifact. The image holds the runtime and the agent, the bootstrap holds the first-boot decisions, and the artifact holds the application code. A release that moves all three at once cannot say which one caused a failure.

The bootstrap is stored in the instance's metadata, and metadata is readable. The text lands in state, is served by the metadata service to anything on the host, and is copied into cloud-init's log. Anyone who can describe the instance or reach the metadata endpoint can read it, so a password written there is a published password.

Instance principal is how a bootstrap gets a credential without a secret. A dynamic group matches the instance by compartment or by OCID, a policy grants that group read access to the secret bundles it needs, and the instance authenticates with its own short-lived certificate. No key file is written, and nothing sensitive enters the plan.

The dynamic group grants the instance, not the process. Every process on that host inherits the same read access, so the boundary is the instance's blast radius rather than the application's. Match by instance OCID when one workload matters, and by compartment when the whole compartment is one trust unit.

Reading the secret in Terraform defeats the design. A secret bundle data source materializes the decoded value in state at plan time, which turns a rotation into a configuration diff and puts the plaintext where the bootstrap was supposed to avoid it. Use it for non-secret configuration only.

The artifact should be fetched by version, not by "latest". A bootstrap that resolves the newest object at boot produces two instances from one image running different code, and the plan shows neither. Render the version into the text so a new member's build is visible before it launches.

Baking the artifact into the image is a valid choice with a different cost. It makes the image the release unit, removes the boot-time dependency on object storage, and turns every code change into an image build. Pick one model and make the other explicit, because a build that does both has two sources of truth.

A first-boot script should converge once and then get out of the way. Cloud-init runs the text at first boot, so a script that tries to reconcile state on every boot hides drift until the next replacement. Anything that must keep converging belongs in an agent with a health endpoint.

A metadata edit is an in-place update that changes nothing on the host. The provider updates the stored text, the plan reports an update, and the running instance keeps the bootstrap it already executed. If the change must take effect, the release is a replacement.

Disabling the legacy metadata endpoints is a compatibility decision. It forces token-based access to instance metadata, which is the posture to want and a silent bootstrap failure on an image whose cloud-init predates it. Check the image before flipping the flag, not after the first boot.

LayerProduced byTerraform holdsWhat a change means
Imageimage pipeline, outside Terraformthe pinned OCID and build referencea new boot artifact, and a replacement
Bootstrapservice repository, renderedthe metadata texta new first-boot path, and a replacement
ArtifactCI, published to object storagea version string inside the texta new build behind the same image
SecretVault, rotated on a schedulean OCID reference, never the valueno diff, which is the proof of the boundary
Identitydynamic group and policythe group and rule namesa permission change, reviewed as code

A rotation that touches no plan is the sign of a correct boundary. Changing a secret in the vault leaves the image, the instance and the metadata text untouched. A rotation that produces a diff means the value was stored in the wrong layer.

The instance principal is also the bootstrap's audit trail. Every read of a secret bundle is logged against the instance that made it, so a failed boot can be distinguished from a permission that was never granted. Read that log before rewriting the script.

Two failure modes look identical from the balancer. A bootstrap that failed and a policy that denied the secret both leave a host that is running and a port that never opens. The difference is in the boot log and the audit log, and neither is visible in a backend health count.

Define Load-Balancer Backend and Health Contracts

The load balancer is regional even when its backends are not. A public balancer needs either one public regional subnet or two public AD-specific subnets in separate availability domains, and a private balancer needs one private subnet. Choosing the regional form is what lets the service place a standby without a second CIDR in the plan.

A regional subnet consumes two addresses from that subnet. The primary and standby nodes both take a private address, which is a capacity detail for a small subnet and a review detail for an address plan that counted one.

Shape is bandwidth, and bandwidth has a floor and a ceiling. The flexible shape takes a minimum, which is the pre-provisioned and billed number, and a maximum, which caps a burst. Sizing the minimum to the peak pays for capacity that idles, and sizing it to the average makes the burst the only thing standing between a traffic spike and latency.

The backend set owns the policy and the health check. A policy such as least connections decides which healthy backend receives the next connection, and the health checker decides which backends are eligible at all. Reading only the policy explains distribution and not the empty pool.

The health check is required, which removes one class of silence. There is no supported state where checks are disabled, so an unhealthy backend is a configuration problem rather than a switch someone forgot. That is a meaningful difference from balancers where checks can be turned off and the pool still looks green.

Retries are symmetric, and that is the trap. The same count governs how many failures mark a backend unhealthy and how many passes restore it, so a value tuned to remove a flapping host quickly also readmits it quickly. There is no separate healthy threshold to trade against the unhealthy one.

A probe that answers is not an application that works. A TCP check passes on any listening socket, and an HTTP check passes on any handler that returns the expected status. Point the check at an endpoint that proves the process can serve, and keep the expensive readiness inside the bootstrap.

The check port is allowed to differ from the service port. When the health checker omits a port, the balancer uses the backend's port, which is correct for a single-process host and wrong for an instance that runs an admin listener beside the application.

TLS has two independent segments. The listener terminates client TLS with a certificate resource, and the backend set can re-encrypt to the instance. A backend that is healthy over the health port can still fail every request because the front-end certificate expired, and that failure never appears in the backend health count.

A plain health path behind an encrypted backend set fails. When the backend set uses SSL, the probe uses SSL unless it is explicitly forced to plain text, so a plain handler on the same port answers the wrong protocol. Match the check to the segment it actually traverses.

Draining is not removal. A backend marked for drain stops receiving new connections while remaining registered, which is the correct way to retire a host without a gap and the wrong way to clean up. The backend list still counts it, and the instance still bills.

A backup backend is a different promise than a weighted one. A backup receives no traffic until every non-backup backend fails its check, which is a disaster posture rather than a capacity posture. It is also incompatible with the IP-hash policy, so the combination is rejected rather than silently ignored.

SettingPurposeA defensible startA wrong value looks like
Health protocol and pathproves the application, not the socketHTTP on a dedicated readiness patha pool that is green while requests fail
Interval and timeouthow fast a failure is noticedseconds apart, with the timeout below the intervalchecks that overlap and never settle
Retrieshow many results before the state flipsthree, read as symmetrica flapping backend that keeps re-entering
Return codewhat a healthy answer looks likethe exact code the readiness path returnsa redirect treated as a failure
Check portwhich listener the probe reachesthe application port, stated explicitlyan admin port that answers for the app
Drain flagretires a host without a gapon, during a replacementtraffic dropped at removal
Backend weightrelative share of new connectionsequal, until a size difference is realone large host saturated first

The probe's source is the balancer, so the rule should name the balancer. Health traffic leaves the load balancer's own address in the backend subnet, which means the instance's NSG needs an ingress rule whose source is the balancer's NSG on the check port. Widening the rule to a CIDR admits every host in the subnet to the port the check uses.

Registration has one owner or it has none. A backend can be declared inside the backend set or added as its own resource, and mixing the two means the next apply of the set rewrites the list and removes the standalone backend. Choose the standalone form when instances arrive and leave independently, and keep the set free of inline backends.

A backend names an address, and an address can be replaced. Because registration is by private address, a replacement that changes the address requires a backend update in the same release. A pinned address keeps the backend stable and moves the risk to the address conflict at creation.

Figure 4 places the two health decisions beside the request path.

Request path through a load balancer listener and backend set to an instance, with the health check and the NSG boundary shown separately A client reaches a TLS listener, which forwards to a backend set with a policy and a required health checker. The backend set names an instance private address and port. The health checker probes the same host on a check port, and the instance NSG admits the load balancer NSG rather than a subnet CIDR. A separate panel shows a healthy backend behind an expired listener certificate. One request path, two health questions Client HTTPS 443 Listener TLS certificate lives here Backend set policy, then health Backend instance private address and port Health checker protocol and readiness path interval and timeout, in milliseconds retries, symmetric in both directions expected return code check port, when it differs NSG boundary source is the balancer NSG on the check port only not a subnet CIDR a wide source admits every host in the subnet Backend states healthy, receiving drained, still registered unhealthy, out of rotation Healthy backend, expired listener certificate The pool is green and every client request fails. The health count never sees the front end. Two numbers, one service The backend list counts registrations, and health counts eligibility. Only the second one is traffic. A check that answers on a socket is a liveness signal. Readiness belongs in the endpoint it calls.

The diagram separates eligibility from reachability. The balancer can remove a backend it cannot reach, and it cannot remove a client failure caused by a certificate it never checks. Both are release risks, and they need different evidence.

Measure a Change and Audit Remaining Volumes and IPs

Replace one member, not the fleet. A controlled replacement is a single destroy-and-create with a known target, and the value of doing one first is that every dependency the plan understated becomes visible while the rest of the fleet still serves.

The plan should show exactly one replacement line. A change that also replaces a subnet, an address or an attachment is a different release with a larger blast radius, and discovering that during apply is how a routine patch becomes an incident. Read the plan summary before reading the diff.

Admission is the gate, not the health check alone. A new backend becomes eligible after the configured number of passes, so the release waits for eligibility and then for real traffic. A check that passes on the first probe proves the port, not the application.

Keep the old member registered while the new one warms. The crossover is a period with both backends in the set, one receiving and one draining. A backend set that is reduced before the new one is eligible has a gap that no plan renders.

Read the booted build from the instance, not from the check. The image OCID a running instance reports is the only proof of which build booted, and a green health count is compatible with the previous image. Record both, and treat a mismatch as a failed release even when traffic is fine.

Draining takes time, and the drain flag has no timer of its own. Connections already established continue until they finish or time out, so the wait before removal is a property of the application's request duration rather than of the balancer. Measure the longest request and wait longer than that.

A failed replacement is cheaper than a failed rollout. Stopping after the first new member is eligible, with the old one still serving, costs one destroy. Discovering the bootstrap was wrong after the fleet is replaced costs a second rollout with no previous build left.

Rollback is the previous image plus a replacement. The previous image OCID, the previous bootstrap text and the previous artifact version are the rollback target, and none of them comes back by reverting a Terraform variable alone if the boot volume was already replaced.

Teardown is a dependency order, not a directory delete. The listener references the backend set, the backend references the private address, the attachment references the instance and the volume, and a destroy that ignores the graph fails on a reference rather than leaving a clean empty compartment.

The leftovers are the objects that outlive their owner. A preserved boot volume, a reserved public IP, a detached block volume and a reserved load balancer address all keep billing and none of them appears in the instance listing. That combination is why the audit uses the provider's inventory rather than the instance state.

Images and boot volumes accumulate faster than configurations. Every build leaves an image, every replacement can leave a boot volume, and a retained image that a retired configuration still names is invisible until the next launch fails. Retain the last few by tag and delete the rest on a schedule.

LeftoverHow it appearsHow to audit itRelease action
Preserved boot volumeno instance references it, storage still billsboot volume inventory per ADdelete after the forensic window
Reserved public IPreleased from the instance, still allocatedpublic IP inventory per compartmentrelease explicitly, never by detach
Detached block volumeno attachment, size still billedblock volume inventory per ADdelete or reattach in the same change
Load balancer reserved addresssurvives the balancer it was attached toload balancer address listingrelease with the balancer, not after
Secondary VNIC attachmentdestroyed after the instance by handattachment listing for the instancedestroy before the instance
Image from a retired buildnamed by nothing in stateimage inventory per compartmentdelete after the rollback window

A release record is one page, and every missing field costs time later. Instance OCID, image OCID, shape and OCPU count, availability domain, private address, backend name, health transitions with timestamps and the rollback target. Write it before the change, not after the incident.

Lab

Measure a Change and Audit Remaining Volumes and IPs

Status: design-only. No OCI tenancy was queried to produce this article, and these steps were not executed here. Versions: Terraform CLI 1.17.1, oracle/oci 9.12.1, verified 6 November 2026.

Prerequisites. A compartment with the VCN and private subnet from the previous part, an NSG that admits the load balancer on one application port, one pinned image OCID, a service limit that allows two extra instances of the chosen shape, and a budget alert on the compartment.

Minimal setup. One private load balancer in the application subnet, one backend set with a required HTTP health check, one instance registered as a backend, one reserved public IP held for a DNS record, and one block volume attached at a known device name.

ObjectLab value
Imagepinned OCID with a recorded build reference
Shapeflexible, one OCPU and the smallest legal memory
Placementone availability domain, fault domain recorded
Instanceno public IP, private subnet, NSG attached
Backendprivate address, application port, weight one
Health checkHTTP on a readiness path, three retries
Volumeone block volume in the instance's AD
  1. Baseline. Record the healthy backend count, the request error rate and the slowest observed request over five minutes. Change nothing until the baseline is boring.
  2. Record the rollback target. Write down the image OCID, the bootstrap text version and the artifact version the running instance reports.
  3. Publish the new image out of band. Build it, record the OCID and the build reference, and confirm the image lists the chosen shape as compatible.
  4. Confirm the plan is one replacement. Run a plan for a single targeted replacement and check that the summary names one instance and no subnet or volume.
  5. Read the new placement. Confirm the shape, the OCPU count, the availability domain and the fault domain the plan will use, and compare them with the record.
  6. Apply and watch admission. Follow the backend through unhealthy, healthy and receiving, and note the interval between the apply finishing and the first pass.
  7. Verify the build, not the check. Read the image OCID the new instance reports and compare it with the one you built.
  8. Drain, then remove. Mark the old backend for drain, wait longer than the slowest request, then remove it and destroy the old instance.
  9. Test the rollback on one member. Replace the new instance with the previous image, confirm the private address and the backend registration behave as expected, then resume.
  10. Tear down and inventory. Destroy with a reviewed plan, then list boot volumes, block volumes, reserved public IPs, secondary attachments and images that no configuration names.
CheckWhere it is readPass conditionWhat a failure means
One replacementplan summaryone instance, nothing else replaceda subnet or address change slipped in
Shape read backinstance detailsthe OCPU and memory pair that was requestedthe request exceeded a bound, or the shape ignored it
Build identityinstance source detailsthe new image OCIDthe plan replaced nothing, or the boot volume was preserved
Backend crossoverbackend healthnever fewer than one eligible backendthe old backend was removed too early
Address stabilitybackend listingthe address matches the instancethe backend names a destroyed host
Teardownprovider inventoryno boot volume, address or attachment without an ownera preservation flag or a reserved address survived

Expected observation. A sequence rather than a duration: plan shows one replacement, the new instance reports the new image, the backend becomes eligible, the old backend drains and is removed, and the rollback returns the previous image. Capture timestamps from the plan, the instance read and the backend health so the three can be joined afterwards.

Failure checks. A replacement that also changes the subnet points at an NSG or address edit folded into the same change. A backend that never becomes eligible points at the readiness path, the NSG source or a bootstrap that failed. A healthy backend with failing requests points at the listener certificate rather than at the instance. A volume that outlives its instance points at a preservation flag or at a volume created outside the configuration.

Cost dimensions. Instance hours for both members during the crossover, boot and block storage per GB-month including anything preserved, load balancer minimum bandwidth rather than peak traffic, and a reserved public IP that bills while unassigned. The lab is small; the leftovers are not.

Cleanup. Destroy the listener before the backend set, remove backends before the instance, release reserved addresses explicitly, and check for boot volumes retained by a preservation flag. Keep state out of version control and delete saved plan files.

References (verified 6 November 2026):

  • oci_core_instance: https://registry.terraform.io/providers/oracle/oci/9.12.1/docs/resources/core_instance
  • oci_core_shapes: https://registry.terraform.io/providers/oracle/oci/9.12.1/docs/data-sources/core_shapes
  • oci_core_image_shapes: https://registry.terraform.io/providers/oracle/oci/9.12.1/docs/data-sources/core_image_shapes
  • oci_load_balancer_backend_set: https://registry.terraform.io/providers/oracle/oci/9.12.1/docs/resources/load_balancer_backend_set
  • oci_core_volume_attachment: https://registry.terraform.io/providers/oracle/oci/9.12.1/docs/resources/core_volume_attachment
  • Compute shapes: https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm
  • Regions and availability domains: https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm
  • Load balancer health checks: https://docs.oracle.com/en-us/iaas/Content/Balance/Tasks/editinghealthcheck.htm
  • Instance principals: https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm

Next in the Series

In OCI Object Storage: Namespace, Bucket Access and Retention, we'll explore Manage storage policy while protecting object data and generated access credentials.