Inventory Existing Deployment and Policy Owners
An ownership register is the first artifact, not the HCL. Every bucket, subnet and role grant already has a declarer: a Deployment Manager deployment, a console habit, a shell script, another root, or nobody. Import is a transfer between declarers, so the register names the current one before a resource block exists.
Deployment Manager is a declarer with delete rights. A deployment's manifest records the properties it set and the resources it lists, and deleting the deployment removes those resources unless the delete abandons them. The manifest therefore proves what one run intended; it does not prove that anyone still maintains the object today. List the surviving deployments before concluding that an object is orphaned.
Config Connector is the same problem in Kubernetes clothing. A custom resource in a cluster declares a Google Cloud object and the cluster's controller reconciles it. If a Terraform root adopts that object, two controllers write it and each reports the other as drift, so either leave it with the cluster owner or delete the custom resource first. The resource's abandon annotation is the documented way to detach it without destroying what it manages.
The console is an owner with no record. A resource created by hand has no manifest and no state address, and the audit log shows the principal that called the create or the policy write, not who is expected to maintain the result. Treat console ownership as a decision to adopt or tolerate, never as evidence that nobody owns it.
Project-wide policy and API managers outrank a workload root. The project allow policy and the set of enabled services belong to every workload in the project at once. When a platform root already writes that policy and that activation list, importing either one into a workload root transfers the right to revoke access from everyone else, which is a much larger change than the one under review.
A second root is the dangerous case. A matching label proves nothing, because anyone with write access can set it. If another state already manages the object, importing it creates two declarers whose plans both look clean, and the next two applies take turns undoing each other.
Some objects should never be imported. Folder-level grants, organization policies, billing links, shared VPC host projects and platform-owned DNS zones are better read through data sources and asserted with preconditions. Referencing them keeps the owning team's pipeline in charge and avoids a transfer you cannot finish.
Reads disagree, so collect more than one. Cloud Asset Inventory is fast but covers resource types unevenly and lags behind the writes it describes. A manifest sees only its own deployment, a state list sees only one root, and a label sees only whoever wrote it last.
Bound the set before writing anything. One project, one service family, ten to twenty objects, and nothing whose replacement loses data. A bounded import is reviewable in one sitting; a project-wide sweep produces a plan nobody reads and a rollback nobody can execute.
The register has fixed columns. Canonical API name, current declarer, the evidence that proves it, the target address and provider, the companion objects, the transfer window and the approver. Table 1 sorts the readable signals by what each one can actually prove.
| Signal | What it proves | Blind spot |
|---|---|---|
| Deployment manifest | One deployment set these properties once | Says nothing about who maintains the object now |
| Config Connector custom resource | A cluster still reconciles this object | Invisible once the cluster or the CR is gone |
| Terraform state address | This root records this API name | One root per read; other roots stay invisible |
| Cloud Asset Inventory query | The object exists in this project | No declarer, uneven type coverage, and lag |
| Audit log entry | This principal made this call | Records the action, not the intent or the owner |
Figure 1 turns that evidence into one decision per object.
%%{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','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
A["Object exists in the project"] --> B{"What record names the declarer?"}
B -->|"deployment manifest"| C["Deployment Manager"]
B -->|"state address"| D["A Terraform root"]
B -->|"custom resource"| E["Config Connector"]
B -->|"nothing"| F["Console, script or orphan"]
C --> G{"Does the deployment still manage it?"}
G -->|"yes"| H["Abandon or detach first"]
G -->|"no"| I["Adopt into one root"]
D --> J{"Same root and prefix?"}
J -->|"yes"| K["Change it where it lives"]
J -->|"no"| L["Transfer through zero declarers"]
E --> M["Leave it with the cluster owner"]
F --> N["Name an owner, then adopt or delete"]
H --> O["Register API name, declarer and evidence"]
I --> O
K --> O
L --> O
N --> O
M --> O
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 A,B,G,J primary;
class C,D,E secondary;
class H,I,K,L,N,O ok;
class M warn;
class F danger;
Figure 2 places the declarers and the project-wide boundaries on one canvas, because the boundary matters more than the inventory count.
The register is finished when two readers agree. One reads the evidence and names the declarer; the other reads the target address and predicts what the first plan will propose. If they disagree, the object is not ready for import, and the next section starts with a smaller set.
Import a Bounded Set and Reach a No-Change Baseline
The canonical identifier is the API resource name. It begins with the project, then the location and collection segments the service defines, and it is what the provider records in state. A console URL and a self-link both wrap that name, so reduce either one to the relative path before pasting anything into a resource block.
Project ID and project number are not interchangeable. Some import shapes accept the ID, some accept the number, and a few accept either. The two strings look similar enough to swap by accident, and the resulting error is usually a not-found rather than a validation message.
Import support is per resource and per provider version. The resource page has an Import section that names the identifier shape, and it is written for the release you pinned. Read that section for 8.10.0 rather than the one you remember from an older line, because shapes do change when a service revises its resource naming.
An import block is a reviewable change. Terraform 1.17.1 accepts an import block that names the destination address and the identifier in configuration, so the transfer appears in the diff like any other edit. The older command-line import still works for one object, but it mutates state and leaves no artifact for a reviewer to read afterwards.
Configuration generation is a draft, not a resource. Generated HCL describes the live API rather than your naming or module conventions, and it can write literal secret values into a file. Read it line by line, move sensitive arguments to references, and treat every generated argument as unconfirmed until a plan agrees with it.
Import to the final address. A temporary address followed by a move doubles the review and leaves an intermediate state other tooling can observe. Decide the module path and resource name first, then confirm that address appears exactly once in the plan.
Inspect the stored identifier before trusting the plan. A state view prints the identifier exactly as recorded, and a read of the same object prints the canonical form the API uses. A one-segment difference means you imported something else; a case-only difference means the configuration, not the object, needs fixing.
Import the companions in the same set. A bucket without its member grant, or a service without its service identity, is half-owned: the next plan proposes to create the missing piece and the create fails against the object that already exists. When a companion belongs to the platform root, record it as external instead of importing it here.
A successful import is not a clean plan. Import records the object, then the next plan compares configuration with the live API. Missing arguments, provider defaults and server-side normalisation all appear as a diff, and some of them are stable differences you must encode rather than argue with.
Labels are a normalisation trap. The provider keeps the labels you set separately from the effective set that includes defaults, so a first plan can show a change on a resource nobody edited. Encode the intended labels once and check that the effective set is the merge you expect.
The baseline is an empty plan with named exceptions. Every remaining diff needs an owner, a reason and a comment, and a diff that another system writes belongs in an ignore rule rather than in a permanent argument. Anything you cannot explain in one sentence is not a baseline yet.
Table 2 gives the identifier shape families an importer actually meets.
| Shape family | Pattern | Common import mistake |
|---|---|---|
| Global collection | projects/{{project}}/global/{{collection}}/{{name}} | Pasting the full self-link URL |
| Regional collection | projects/{{project}}/regions/{{region}}/{{collection}}/{{name}} | Omitting the region because the provider has a default |
| Zonal collection | projects/{{project}}/zones/{{zone}}/{{collection}}/{{name}} | Swapping zone and region segments |
| Project singleton | projects/{{project}}/{{collection}}/{{name}} | Using the project number where the ID expects the project ID |
| IAM association | The documented composite of scope, role and member | Guessing the separators rather than reading the section |
Figure 3 traces the loop and the five ways a plan can answer back.
%%{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','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
A["Bound the set: one project, one service family"] --> B["Read the canonical API name"]
B --> C{"Import documented for 8.10.0?"}
C -->|"no"| C1["Keep it external or adopt by hand"]
C -->|"yes"| D["Write the block at its final address"]
D --> E["Import block names the identifier"]
E --> F["terraform plan"]
F --> G{"Result for the imported address"}
G -->|"not found"| G1["Wrong project, location or ID shape"]
G -->|"already managed"| G2["Another address or another root owns it"]
G -->|"replacement"| G3["Schema or immutable field disagrees"]
G -->|"in-place diff"| G4["Default or server value not encoded"]
G -->|"no changes"| H["Apply once, then remove the import block"]
G1 --> B
G2 --> C1
G3 --> D
G4 --> D
H --> I["Baseline: empty plan on the next run"]
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 A,E,F,H primary;
class B,C,D secondary;
class G,I ok;
class C1,G1,G3 danger;
class G2,G4 warn;
Sort the answers before changing anything. A not-found is a reading error, an already-managed answer is an ownership error, a replacement is a schema error, and an in-place diff is an encoding error. Each one has a different fix, and only the last one is usually safe to accept as a diff you will keep.
A failed import is cheaper than a duplicate create. The import writes state and never changes the project. If the plan after import proposes a replacement, the object was not what you thought it was, and stopping there costs one review cycle instead of an outage.
Coordinate Google and Google-Beta Upgrades
Two providers, one API surface, two release contracts. The GA provider ships generally available features; the beta provider ships preview features against the same endpoints and the same credentials, with no deprecation guarantee. Sharing an identity is not sharing a promise, so the count of resources pinned to beta belongs in every review.
Pin both providers to the same exact version. In this build both entries are 8.10.0, and the lock file records hashes for each platform the pipeline uses. A version range lets the resolver pick a different binary per provider, which is how a field appears in one plan and vanishes from the next.
Provider selection is per resource, not per feature. A resource with no provider argument goes to the default GA instance even when a beta block sits in the same directory. The beta block also inherits nothing, so the project and region are duplicated or the module declares both aliases.
One object, one writer. A cluster, bucket or network exists once in the API, whoever declares it. Two resources for one object, one through each provider, means every apply writes its own schema view and the other plans a revert; neither converges.
Promotion happens in one direction and one change. When the field you need graduates, move that resource back to the GA provider in a dedicated commit, and let the plan tell you whether the entry survives the move. Leaving a second resource behind to obtain one field recreates the revert loop.
A same-name promotion reuses the state entry. If the GA type has the same name as the beta type, the state entry stays valid and only the provider address changes, so a replacement proposal means the schemas disagree about an argument. Read that diff as a schema question before you read it as an outage.
A renamed promotion needs a move the provider supports. A move block across resource types only works when the provider declares it, and a rejected move means the state entry cannot be carried. Import into the new type in a window where neither resource declares the object, rather than removing from state and creating in one apply.
Beta schemas churn on minor versions. A beta field can change shape or default between minor releases while the GA schema stays stable, which is why a beta resource needs its own rehearsal on every bump. Treat the beta pin as a dated exception with an owner, not as a permanent preference.
API enablement travels with the feature set. A beta-only field can need a preview API that the GA surface never calls, so enabling it belongs in the same change as the field. The activation stays with the platform root, because the workload root that needs it does not own the switch every other team shares.
Deletion behaviour can differ between the two schemas. A destroy-time guard that defaults on in one provider and off in the other turns a promotion into a change of what destroy means. Read the deletion arguments on both sides before the move, and keep the effect you had instead of the default you inherit.
The provider release chooses the API version. There is no general argument for pinning the underlying API version of a resource; the version arrives with the binary. What you control is the provider pin, the beta surface you opt into, and the arguments that expose preview behaviour, so the plan is the only honest prediction of what a bump does.
Sort the plan into four buckets. Refresh noise re-reads computed values, normalisation rewrites a representation, address changes belong in move blocks, and replacement is the only bucket that can cause an outage. A replacement needs a named reason in the change record, not just a count in a summary.
Rehearse the pair, not the provider. Read the changelog between your pin and the target for both providers, run the new pair on a branch against a non-production project, and diff the plans before and after. The release notes describe intent; the two plans describe the change you are actually buying.
Table 3 lists the change classes a first plan after an upgrade tends to contain.
| Change class | What the plan shows | Review action |
|---|---|---|
| Argument removed in the release | Validation error before any API call | Replace the argument, then confirm no replacement |
| Field marked force-new | Replacement, drawn as remove and recreate | Name the reason and schedule the outage |
| Provider default changed | In-place update with no configuration edit | Encode the old value, or accept and record it |
| Resource renamed at GA | Unknown type, or a move the provider rejects | Move when supported, otherwise import in a window |
| Beta-only field graduated | The field validates on one provider only | Move the resource, then drop the beta pin |
| Computed field added | An in-place update that only adds an attribute | Confirm it is additive before approving |
Beta is a source of fields, not a destination. Every beta-only field is outside the GA contract, and a resource that stays there is a resource you have agreed to upgrade more often. Keep the list short enough that each entry can be justified by naming the field and the date it was needed.
Promote Through Federated CI with Protected Artifacts
Federation replaces the stored key. A workload presents a short-lived OIDC token and impersonates a service account whose binding restricts the repository, branch or environment allowed to present it. Nothing long-lived is stored, and deleting the provider or the binding is the off switch.
Plan and apply should not share an identity. The plan identity reads the target project and the state bucket; the apply identity writes both and holds only the service-level admin roles the change needs. A pull-request plan then cannot change infrastructure even if someone edits the workflow file.
The state bucket is part of the trust boundary. State holds resource identifiers, outputs and often sensitive values, so the bucket gets uniform access, versioning and one prefix per root. The state object is the lock, so a second apply waits or fails instead of interleaving.
The saved plan is the approval unit. Write the plan to a file, render its JSON, hash both, and keep them with short retention. Approvers approve that hash and the apply job downloads exactly that artifact; a workflow that re-plans after approval has approved a different change.
A saved plan is bound to the state it was made from. If another run writes that prefix between plan and apply, the saved plan is stale even though the commit has not moved. That is a control, not a bug: reject the apply and plan again from the same commit.
Record four coordinates for every promotion. The project and its number, the identity that applied, the source commit with the lock file hash, and the digest of any application artifact the configuration references. A container image named by tag is the usual gap, because the plan reads a resolved digest that the next deploy can replace.
Immutable inputs close the review gap. Apply from a commit SHA with the committed lock file rather than a moving branch head, and publish the Terraform version, both provider versions and the plan hash with the change. Without those values, the change cannot be reproduced even by the person who approved it.
Serialise per state prefix and never cancel an apply. A concurrency group keyed on the prefix lets one run finish before the next starts, and cancel-in-progress turns a slow apply into a partial one. A held lock is a queue signal, not a reason to force-unlock.
A scheduled read-only plan is the drift alarm. Run it with the plan identity, treat exit code two as changes exist, and route the result to the owner instead of auto-applying. The same run proves the federation still works after a credential or binding change.
Record the exclusion, not just the inclusion. A beta resource, an imported object and a data-source reference are all deliberate exceptions to the rule that one root owns one object. Write them into the change record, because the reviewer who approves the plan is also approving the exception list.
Figure 4 shows the gates in order, and Figure 5 contrasts the four coordinates with what a green apply actually proves.
%%{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','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
A["Merge to a commit SHA and keep the lock file"] --> B["Plan job with the read identity"]
B --> C["Save plan file, JSON and SHA-256"]
C --> D{"Approval for that hash?"}
D -->|"no"| D1["Stop before apply credentials"]
D -->|"yes"| E["Apply job behind the environment gate"]
E --> F["Queue keyed on the state prefix"]
F --> G{"State lock acquired?"}
G -->|"no"| G1["Wait or fail, never force-unlock"]
G -->|"yes"| H["Apply the downloaded plan"]
H --> I{"Apply finished?"}
I -->|"no"| I1["Partial state: fresh plan, then import or retry"]
I -->|"yes"| J["Verify with a no-change plan"]
J --> K["Publish project, identity, source and hash"]
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 A,C,H,K primary;
class B,E,F secondary;
class G,J ok;
class D1,G1,I1 danger;
class D,I warn;
The right column is the change record, not the workflow log. A workflow log answers what happened in one run; the change record answers what exists now and how to rebuild it. Publish the second one, and keep the first only as long as the retention policy allows.
Recover Drift Without Revoking Shared Access
A partial apply is a normal failure, not a corrupted state. Terraform stops at the first error, records the resources completed before it, and leaves the failing one either absent or present and tainted. The exit code is non-zero, and the saved plan can no longer be resumed.
Never re-apply the old plan file. It describes a graph that no longer matches reality. Run a fresh plan, read what it proposes for the addresses that did land, and treat any create against an object that exists as an import candidate instead of a retry.
Diagnose the layer before touching state. A disabled API, a missing permission, an exhausted quota, an organization policy and a project lien all stop the same graph and need different responses. The error reason names the layer; the plan summary does not.
The confusing denial is usually propagation. A policy write returns before every service honours it, and the documented guidance is minutes rather than seconds, with group membership taking longer still. Retry with backoff, test the permission directly, and do not recreate a binding that is already correct.
API enablement lags the apply that enabled it. The enable call returns a long-running operation and the provider waits for it, but the first dependent request can still fail with an activation hint. Order the dependency explicitly and retry the failing call rather than sleeping in a loop.
The tempting repair is the dangerous one. After a partial apply it is easy to import the whole project policy, or to set destroy-time disabling so a teardown succeeds, and both widen the blast radius beyond the change. Reconcile at member scope and leave the shared boundary with its owner.
Reconcile in three passes. List state to see which addresses are recorded, refresh to learn what the APIs hold, then decide per address: keep and import, drop without destroying, or replace deliberately. A tainted object is a replace decision, not an import.
Use a removed block when an object should leave state. Declaring it removed with destroy disabled drops the record without calling the API, which is the correct move for an object another team has taken over. Deleting the resource block instead proposes a destroy, and that is a different change.
Recovery is not a place for targeting. A targeted apply repairs one address and leaves the graph's other promises unverified, so a later full plan surprises the next reviewer. Use targeting to unblock a named dependency, then finish with an untargeted plan.
Table 4 sorts the common failures by the layer that has to answer them.
| Symptom | Layer | First read | Safe next action |
|---|---|---|---|
| Service disabled at apply | API activation | Enabled services for the project | Enable through the platform root, then replan |
| Denial just after a grant | IAM propagation | Policy read plus a direct permission test | Wait and retry, keep the binding |
| Quota exhausted on one resource | Quota | Usage for the project and region | Request quota, or narrow the change |
| Precondition naming a constraint | Organization policy | The constraint and its enforced value | Change the configuration or request an exception |
| Name already exists | Global namespace | The existing object and its declarer | Import it or rename, never retry blindly |
| Destroy blocked on the project | Lien or deletion policy | Project liens and the deletion policy | Clear it as its own reviewed change |
Close with evidence, not relief. Confirm the final plan is empty, the identifiers you meant to keep are unchanged, the shared policy still contains the other teams' principals, and temporary roles, locks and artifacts are gone. Attach the plan hash and the verification output to the change record.
Recover Drift Without Revoking Shared Access
Status: design-only. No Google Cloud project, credential or billable resource was used for this article, and none of the steps below was executed. Every identifier is a placeholder: substitute your own disposable project, bucket and service.
Prerequisites. Terraform CLI 1.17.1, hashicorp/google and hashicorp/google-beta both at 8.10.0, gcloud signed in, ADC for a principal that can write the scratch project, and one non-default API you are willing to disable. Two identities are needed: a read-only planner and a writer that applies.
Setup. One root holds a bucket, a service account and a member grant for a second test principal. A second root, standing in for the platform team, owns the API activation with destroy-time disabling left off. A console-created bucket exists in the same project and is not yet in any state.
- Apply the workload root and confirm the next plan is empty.
- Import the console-created bucket and one member grant, then read the stored identifier and compare it with an API read.
- Confirm the plan is empty and record each address with the provider that owns it.
- Remove the planner's read role outside Terraform, then plan. Expect a denial while the change propagates, not a configuration error.
- Declare a bucket whose name already exists in another project, apply, and record the exit code and the addresses that landed.
- List state, then plan fresh. Classify every address as keep, import or replace before editing anything.
- Disable the non-default API from the platform root and observe the dependent workload fail, then enable it again and replan.
- Restore the read role, remove the duplicate declaration, apply the fresh plan, and confirm the final plan is empty.
| Address after step 5 | State | API reality | Correct action |
|---|---|---|---|
| Workload bucket and grant | Recorded | Exist and unchanged | Leave them alone |
| Duplicate bucket name | Absent | Exists under another owner | Import it or rename, never retry |
| API activation | Recorded by the platform root | Enabled | Leave the owner and the setting as they are |
| Planner role | Changed outside Terraform | Read role removed | Restore as its own reviewed change |
Expected observation. Step 4 fails with a denial while the policy write is still propagating, which is why the retry succeeds where the first attempt did not. Step 5 exits non-zero after the earlier resources are recorded, and the fresh plan in step 6 proposes one create rather than repeating the whole set. Step 7 fails inside the dependent workload, not in the root that owns the activation.
Failure check. If step 6 wants to create the workload bucket, state was never written for an object that exists, so import it instead of applying a duplicate. If the fresh plan proposes to destroy the grant, the import landed at a different address than the one the configuration uses. If step 7 leaves the workload healthy, the API you chose is not actually required by it, so pick another before drawing conclusions.
Cost and cleanup. A scratch project, one bucket and one service account cost cents for the session. Delete the imported resources through the root, remove the console-created object, confirm the shared policy still holds the other principal, then delete the project and the two temporary bindings.