Around Go: DevOps and reliability · 3 MIN READ

Infrastructure as code: plan, lock and inspect drift

Explain state ownership, review a proposed change and recover from a failed apply without discarding evidence.

Declarative infrastructure tools compare configuration, recorded state and an observed provider view. A plan is a proposal at an observation boundary; it is not a guarantee that the world stays unchanged until apply.

Go for DevOps and reliability · A MAP OF THE IDEA

  1. Confirm backend and account
  2. Observe state and provider
  3. Review and lock one writer
  4. Inspect outcome and re-plan

Useful when

  • Explain state ownership, review a proposed change and recover from a failed apply without discarding evidence.
  • Keep an explicit contract and retain both successful and denied observations.

Watch out

  • Locking coordinates cooperating writers; it does not prove that an apply is safe or that external drift cannot happen.

Implementation & operation cost: Real provider and network evidence requires an owned disposable environment; local files describe a contract without performing the integration.

01

Separate the three views

Configuration describes intent; state binds configured resources to provider objects; a refresh observes the current remote system. Drift is an out-of-band change, not necessarily permission to overwrite it. Before an apply, identify the workspace, backend, account and region. A correct plan against the wrong account is still a dangerous change.

02

Preserve state ownership

Use a backend with appropriate state locking and access control, keep state and plan files out of public repositories, and serialize writers. State can contain sensitive values. Do not remove a lock simply because another job is slow: establish ownership and whether the operation is still running. A forced unlock or manual state edit requires a recovery procedure and evidence.

03

Verify outcomes and recovery

Review create/update/destroy actions and blast radius before an explicit apply in a disposable environment. After a partial failure, inspect both provider reality and state, re-plan and resolve the cause. Do not delete state to make a red error disappear. Restore and import are operations with identity and backup requirements, not generic undo commands. The app provides no provider executables or remote backend; the exercise here is a reviewable plan and access checklist, followed by a real rehearsal in your own environment.

text
configuration: desired replicas = 3
state:         service id = svc-42, last replicas = 2
provider:      svc-42 currently has 1 replica
plan:          update svc-42 to 3, destroy 0
apply:         requires owned lock and explicit approval
Read the code

The service identity binds state to one real resource. Refresh discovers a count of one; configuration still requests three. Review the update against that observation and the selected account before applying. If an apply fails, preserve both the state and provider evidence, then make a fresh plan instead of assuming every action was rolled back.

TAKE THIS WITH YOU

Treat infrastructure state as sensitive operational evidence with one accountable writer.

Check your understanding

What should follow a partial apply failure?

Go to the source

Progress stays in this browser. No account needed.