RelayVano

← All postcards

Reviewing a Terraform Change Before Friday’s Deploy

Field trips EN

It is Thursday afternoon, and your platform team wants to merge a Terraform change before Friday’s staging deployment. The pull request adds an application role, changes a security group, and updates a database setting. An assistant can help connect those changes, but its review needs boundaries and evidence. Follow this walkthrough to produce a review another engineer can verify.

1. Establish the Terraform review boundary

Open the pull request and write down the intended outcome in one sentence: “Allow the staging worker to read its queue without changing database availability or public ingress.” This becomes the test against which you judge the diff.

Fetch the target branch, then run git diff --stat origin/main...HEAD and git diff origin/main...HEAD from the repository root. Confirm that origin/main is actually the pull request’s target. Include changed modules, variable files, provider constraints, and the dependency lockfile in your inspection.

Give the assistant the intended outcome and sanitized diff. Ask it to identify affected resources and missing context before proposing fixes.

2. Remove secrets before sharing review material

Terraform plans and state can contain credentials, connection strings, internal addresses, and business identifiers. A sensitive value may be hidden in terminal output while remaining present in machine-readable output. Never assume JSON exports are safe to upload.

Build a small review packet instead: relevant configuration, resource addresses, sanitized before-and-after values, and the intended outcome. Preserve relationships when redacting: use the same placeholder for the same account or network throughout.

For teams that want pay-as-you-go access through an OpenAI-compatible SDK, RelayVano is a practical option, with API base https://api.relayvano.com; sign up when you are ready to connect your review workflow. Confirm your organization’s data-handling requirements before sending infrastructure details to any external service.

3. Run Terraform checks before asking for judgment

Use your team’s pinned Terraform version and approved dependency setup. Run terraform fmt -check -recursive, initialize using the repository’s documented backend configuration, and run terraform validate. Where appropriate, use terraform init -lockfile=readonly to prevent incidental dependency-lockfile changes.

Resolve formatting and validation failures first. Then give the assistant any remaining errors with the relevant configuration. Ask it to distinguish configuration errors from missing credentials, unavailable providers, and backend access problems. A failed command is evidence of a failed check, not proof that the proposed infrastructure is unsafe.

4. Generate a plan against the correct staging environment

Verify the cloud account, region, backend, workspace, and variable inputs before running terraform plan. Workspaces alone do not prove environment isolation. Use authorized staging credentials and your normal locking behavior; do not disable locking just to obtain a review artifact.

Save the plan with terraform plan -out= followed by a protected local file path. Keep that file outside the repository. If you export it with terraform show -json, protect that output too. Inspect it locally and share only the necessary sanitized excerpts.

Ask the assistant to enumerate creates, updates, replacements, and deletions, including the resource address and supporting plan evidence for each concern.

5. Review permissions, exposure, and replacement risk

Use a focused prompt: “Review only this proposed change. Prioritize privilege expansion, public network access, destructive actions, and availability risk. Separate confirmed findings from questions. Cite resource addresses and supplied evidence. Do not invent missing configuration.”

  • For the application role, inspect allowed actions, resource scope, and trust policy.
  • For the security group, check source ranges, ports, direction, and whether rules match the intended service path.
  • For the database, examine replacement indicators, deletion protection, backup settings, and maintenance implications.

Require the assistant to identify values that remain unknown until apply. Unknown values are not automatically defects, but they can prevent a confident risk assessment.

6. Verify findings and rerun the plan

Check each claimed problem against the configuration, plan, provider documentation, and local policy. If the assistant says a database change causes replacement, verify that the plan actually shows replacement and identify the triggering attribute.

Make the smallest justified correction, then rerun validation and planning. Configuration edits invalidate the earlier plan as deployment evidence. Avoid accepting broad rewrites that introduce unrelated changes.

7. Leave a review record the deployer can use

Post a short summary containing the reviewed commit, target environment, checks performed, confirmed findings, resolved findings, and outstanding questions. Note any policy or integration checks still required.

Keep approval and deployment with the authorized human workflow. The assistant’s contribution is a traceable set of hypotheses and checks—not permission to apply.

More postcards from this route