delivered for clients · names withheldmodernization Cloud and infrastructure

Hand-built cloud to Terraform or OpenTofu

Cohash brings hand-built cloud estates under infrastructure as code. We start by inventorying what actually exists in AWS, Azure or Google Cloud. Then we import it into Terraform or OpenTofu with import blocks, without rebuilding anything, and split state by team and environment. Every change moves into pull requests with plan review and policy checks. Once that works, console write access goes away for everyone except a break-glass role.

  1. 01Inventory and ownership
  2. 02Module and state layout
  3. 03Import without rebuild
  4. 04Pipelines and policy
  5. 05Lock the console
case-study / clickops-to-infrastructure-as-code delivered
beforeConsole-built cloud resources afterTerraform or OpenTofu in pipelines
01 · PEOPLE 02 · CODE AND PIPELINE 03 · CLOUD ESTATE Engineers: read-only console Engineers read-only console Break-glass role: logged · alerted Break-glass role logged · alerted Module and state repos: per team · per environment Module and staterepos per team · perenvironment Terraform or OpenTofu CI: plan on PR · apply on merge Terraform orOpenTofu CI plan on PR · apply onmerge Policy checks: tags · IAM · public storage Policy checks tags · IAM · publicstorage Cloud resources: AWS · Azure · Google Cloud Cloud resources AWS · Azure · GoogleCloud Remote state: encrypted · locked Remote state encrypted · locked Drift detection: scheduled plan Drift detection scheduled plan
case file

The story

Told without the client's name or anything that could identify them.

what happened

A logistics company's platform team ran production that had been built in the cloud console, documented only by an old wiki page. An audit question about who changed a security group was answered from CloudTrail, rebuilding a test environment meant repeating every click by hand, and the bits of Terraform that existed had drifted so far that nobody ran apply. We inventoried resources by account with owners, flagged the ownerless ones for retirement, and agreed module boundaries and a state layout per team and environment. Existing resources were brought in with import blocks until each plan showed no changes, with nothing rebuilt. Changes now go through pull requests with plan review and policy checks, and console write access is limited to a logged break-glass role.

why it was urgent

Terraform 1.16 came out on 26 August 2026 and allows import blocks inside modules. That makes bulk imports of existing resources far less painful. Licensing is the other reason teams are looking again. HashiCorp moved Terraform to the Business Source License in August 2023, IBM closed its purchase of HashiCorp on 27 February 2025, and many teams now choose between Terraform and the OpenTofu fork at the same time.

problem statement
  • openSomebody built production in the console. What's written down is a wiki page from two years ago.
  • recurringAn audit asked who changed a security group and the answer came from CloudTrail, not a pull request.
  • blockedRebuilding a test environment takes a week of clicking.
  • openSome Terraform exists, but drift is so large that nobody runs apply anymore.
architecture

The estate, before and after

before
before

Before: production built by hand in the console

Engineers changed AWS, Azure and Google Cloud resources directly in the console with broad rights. A small amount of Terraform existed, but drift meant nobody ran apply, and the only change record was the cloud audit log.

Before: production built by hand in the console Engineers changed AWS, Azure and Google Cloud resources directly in the console with broad rights. A small amount of Terraform existed, but drift meant nobody ran apply, and the only change record was the cloud audit log. 01 · PEOPLE 02 · CHANGE PATH 03 · CLOUD ESTATE click changes create · modify rare apply change events notes Engineers console admin rights Cloud console manual changes Drifted Terraform nobody runs apply Cloud resources AWS · Azure · Google Cloud Audit logs CloudTrail · activity log Wiki page out of date
Read the diagram as text
  1. Engineers → Cloud console: click changes
  2. Cloud console → Cloud resources: create · modify
  3. Drifted Terraform → Cloud resources: rare apply
  4. Cloud resources → Audit logs: change events
  5. Engineers → Wiki page: notes
after
after

After: every change goes through a pipeline

Terraform or OpenTofu changes go through pull requests, where we review the plan and run policy checks before apply. The pipeline gets into the cloud through OIDC federation, and drift detection flags whatever changed outside code.

After: every change goes through a pipeline Terraform or OpenTofu changes go through pull requests, where we review the plan and run policy checks before apply. The pipeline gets into the cloud through OIDC federation, and drift detection flags whatever changed outside code. 01 · PEOPLE 02 · CODE AND PIPELINE 03 · CLOUD ESTATE pull request plan check plan OIDC apply read · lock compare emergency change Engineers read-only console Break-glass role logged · alerted Module and state repos per team · per environment Terraform orOpenTofu CI plan on PR · apply onmerge Policy checks tags · IAM · public storage Cloud resources AWS · Azure · Google Cloud Remote state encrypted · locked Drift detection scheduled plan
Read the diagram as text
  1. Engineers → Module and state repos: pull request
  2. Module and state repos → Terraform or OpenTofu CI: plan
  3. Terraform or OpenTofu CI → Policy checks: check plan
  4. Terraform or OpenTofu CI → Cloud resources: OIDC apply
  5. Terraform or OpenTofu CI → Remote state: read · lock
  6. Drift detection → Cloud resources: compare
  7. Break-glass role → Cloud resources: emergency change
results

What the client got

What changed for the client once the work was done. Described, not scored: we don't publish client figures.

  1. result 01

    Every change has a pull request

    Plan runs on every pull request and apply runs on merge. If someone asks who changed a security group, the answer is a reviewed commit, and nobody has to dig through CloudTrail.

  2. result 02

    Existing resources are in code, unchanged

    Everything came in through import blocks and generated configuration. No stack was applied until it showed a zero-change plan and a person had read that plan.

  3. result 03

    Policy checks run before apply

    Public storage, open security groups, missing tags and overly broad IAM now get caught in the pipeline. And the pipeline signs in to the cloud with OIDC federation instead of long-lived keys.

  4. result 04

    The console is read-only for daily work

    Day-to-day roles lost console write access. A logged break-glass path remains, and scheduled drift detection catches changes made outside code.

  5. result 05

    State is split and protected

    We split state per environment and team, and one plan can't reach across all of it any more. Remote state is encrypted, locked and readable by pipelines alone.

what can go wrong

Risks we plan for

  1. Import that quietly changes resources

    One wrong default in a generated config and the first apply replaces your database. That's why each import finishes with a zero-change plan that a person reads.

  2. State with secrets in it

    Terraform state can hold passwords and keys. We keep remote state encrypted and locked, readable by pipelines only.

  3. Choosing a tool on licence alone

    OpenTofu and Terraform have diverged on newer features. The choice is checked against the features and HCP Terraform integrations you actually use.

ai in this move

Where AI helps, and where it needs guardrails

HashiCorp's Terraform MCP server lets an assistant look up provider docs and modules. Turn on operations and it can manage HCP Terraform workspaces as well. We use AI to draft import configs and module refactors, and plan review catches its mistakes. We keep operations off by default, and assistants only ever get read-only cloud credentials. Apply rights stay with people.

forward deployed engineers →
you keep

What you're left with

We write these for your setup, and they're working documents. Your team should be able to keep things running from them long after we've gone.

  • inventory01

    Resource inventory with owner and retire-or-keep decision

    yours to keep
  • code02

    Module library and state layout per environment

    yours to keep
  • plan03

    Imported configuration with a zero-change plan per stack

    yours to keep
  • code04

    CI pipeline with policy checks and OIDC cloud credentials

    yours to keep
  • plan05

    Drift detection schedule and break-glass procedure

    yours to keep
talent and delivery · terraform or opentofu in pipelines

Certified engineers, wherever you need them.

Some clients want a project team, some want a couple of engineers on theirs. Either works. Onsite, nearshore or offshore, with handovers across time zones that keep things moving.

Onsite

Engineers at your sites in the US

Nearshore

Overlapping hours with US teams

Offshore

Overnight progress on your backlog

All time zones

Coverage handed over across time zones

24-hour coverage · US Central time
OnsiteUS business hours
Nearshoreoverlapping US hours
Offshoreovernight progress
Combinedhandover, not hand-off
01Terraform or OpenTofu?

It depends on your legal team's view of the Business Source License and whether you rely on HCP Terraform or the newest Terraform-only features. Most code moves between them with small changes. We review your usage and tooling before recommending either.

02Do we have to rebuild resources to get them into code?

No. Import blocks bring existing resources into state. We only rebuild something when its current setup is wrong enough to fix anyway, and we schedule that separately.

03How long does it take?

It depends on resource count, how many accounts or subscriptions you run and how far existing Terraform has drifted. We import one representative stack first and size the rest from that.

04Can you also set up the landing zone?

Yes, and a lot of teams do both at once. New accounts get vended from code while the old ones are being imported.

sources 5 sources linked last checked 2026-10-20 content fingerprint 22fd4601
  1. 01GitHub: Terraform v1.16.0 releasegithub.com ↗
  2. 02HashiCorp: HashiCorp adopts Business Source Licensehashicorp.com ↗
  3. 03IBM: IBM completes acquisition of HashiCorp (27 Feb 2025)newsroom.ibm.com ↗
  4. 04OpenTofuopentofu.org ↗
  5. 05GitHub: HashiCorp Terraform MCP servergithub.com ↗
Reviewed by the Cohash team Product names are trademarks of their owners. how we handle facts and data →
next step

Planning this move?

A 30-minute working session with a senior engineer. No slides.

useful to bring
  • The platform and the version you're on
  • Where you need to get to, and by when
  • What's custom: rules, plugins, integrations
  • Any audit finding or deadline driving it