OpenTofu on Docker vs Kubernetes vs VMs

OpenTofu is a command line tool, so the deployment choice is really about the runner, state access and secrets around it. This page shows which model fits which team and what each one costs to operate.

On this page

Which OpenTofu deployment option fits your team

If your team runs OpenTofu from CI or a shared host and has to decide where that runner lives, Docker suits a small team that already operates container hosts, Kubernetes suits a platform team that already operates clusters and GitOps, and VMs suit a team whose estate already runs on a hypervisor. OpenTofu behaves the same in all three. It is licensed under the Mozilla Public License 2.0, was accepted to the CNCF Sandbox on April 23, 2025, and its v1.13.1 release shipped on October 1, 2026. The decision therefore turns on who operates the runner host, including its patching, network path and the credentials it holds. Start by listing which platform your operations team already patches, monitors and backs up, because a runner on an unfamiliar platform adds a new operating burden.

Docker is the lightest option when the runner is one job among many. An ephemeral container per run is quick to replace, which suits a small team that already has container hosts and an image pipeline. The condition is that the host is locked down, because access to the Docker socket is effectively root on that host, so do not mount it into job containers. Kubernetes gives you scheduling, namespace isolation and GitOps tooling such as Argo CD or Flux, but those advantages only matter if the cluster and its GitOps practice already exist. Building a cluster just for runners adds control plane and etcd work that your team must then patch and back up. VMs fit an estate on a hypervisor such as Proxmox VE or XCP-ng, where snapshots, backup and access control already exist. A long-lived runner VM accumulates state, so pair it with a routine that rebuilds it from a clean image.

Whichever option you pick, confirm which identities the runner uses before you commit. Check whether the cloud and state backend credentials can be scoped to one workspace, and whether they are delivered from a secrets store rather than stored on the host. Next, decide where state encryption keys are held. OpenTofu's state and plan encryption supports PBKDF2 and key providers including AWS KMS, GCP KMS, OpenBao and Azure Vault, so confirm that the runner's location can reach the provider you choose. The OpenTofu state encryption documentation lists the configuration. Finally, plan the switching cost. The configuration and state should not need to change when the runner moves, but the host image, secret delivery and network allowlists will, so rehearse a move against a non-production workspace.

How Docker, Kubernetes and VMs compare for OpenTofu runs

This table compares how OpenTofu runs are packaged, kept available, sized and paid for on Docker hosts, Kubernetes and virtual machines. Read each row as a question to answer for your own environment, since cost and effort depend on existing skills and hosting contracts. The main takeaway is that the OpenTofu configuration stays the same on all three, while operating effort and the people who pay for capacity change.

DimensionDocker hostKubernetesVirtual machines
Runner architectureOpenTofu runs in a container image on one or more Docker hosts, started per job or kept as a long-lived runner.Runner pods or Jobs scheduled by the cluster, with the OpenTofu image pinned in the job template.A long-lived runner VM with the OpenTofu binary installed and registered to your CI or automation controller.
Availability modelUsually one host unless you add an orchestrator, so a host failure stops queued runs until it is restored or moved.The scheduler restarts failed runner pods, but availability also depends on the control plane and node design you confirm up front.Availability comes from the hypervisor cluster and runner redundancy you configure, usually a second runner VM.
Sizing inputsConcurrent plans, CPU and memory per container, provider plugin cache size and the host capacity behind them.Concurrent runs, pod resource requests, node headroom for bursts and the throughput of the remote state backend.Concurrent runs per VM, CPU and memory per runner, disk for the provider cache and hypervisor headroom for failover.
Skills requiredContainer image builds, registry handling and Linux host hardening, often the smallest new skill set.Cluster operations, RBAC, network policy, secret handling and upgrade planning on top of OpenTofu itself.Hypervisor administration, OS patching, VM templating and runner configuration, familiar to teams that already run VMs.
Upgrade pathRebuild the image with the new OpenTofu release, test a plan in staging, then roll the tag forward.Change the pinned image in the job template, while cluster upgrades run on their own schedule and need their own testing.Replace the binary or image on each runner VM, alongside the hypervisor patch cycle that runs in parallel.
State and key handlingPass state encryption key material through host secrets and confirm which containers can read it.Use Kubernetes Secrets or an external secrets operator, and scope key access to each namespace.Store key material in the VM secret store or a KMS provider, and confirm each runner reads only its own workspace keys.
Who pays for host capacityYour team pays for the hosts, storage and the staff who patch and monitor them.Your team pays for node capacity, the control plane (self-run or managed) and the platform staff who operate the cluster.Your team pays for hypervisor hardware, any subscription you choose and the staff who run the VM estate.
Subscription termsNo hypervisor subscription in the base setup; confirm the terms of any registry or commercial support you add.Kubernetes is Apache-2.0 licensed; managed service and support contracts are separate costs to confirm.Example terms: Proxmox VE is priced per CPU socket with support level as the difference; XCP-ng 8.3 LTS is supported until November 30, 2028.

What runs in each model and what stays the same

The deployment model changes where OpenTofu runs, while the work it does stays the same. In every model, the binary reads your HCL configuration, reads and writes state and plan files, and calls providers over their APIs to create or change resources. Your .tf files, modules and provider blocks do not change whether the binary runs in a Docker container, a Kubernetes Job or a virtual machine. What changes is the host the runner occupies, the scheduler that starts it and the credentials it holds. Map those three items for your own pipeline before choosing a model, because they drive most of the operating effort.

State and plan encryption is a control that every runner must be able to reach. OpenTofu encrypts state and plan files at rest, for local storage and remote backends, and the feature was introduced in v1.7. The OpenTofu state and plan encryption documentation lists the key providers as PBKDF2, AWS KMS, GCP KMS, OpenBao and Azure Vault. The cloud and secrets-manager providers need network reach and an identity the runner can use, so a container without an egress route or a VM without the right role can fail to read state. PBKDF2 instead depends on a passphrase that must be delivered to each runner securely. Test a plan from each runner type with your chosen provider before cutover, and confirm the exact configuration keys in the documentation.

Pin the OpenTofu version in every runner, and upgrade all of them in the same change window. At the time of writing, v1.13.1, released on October 1, 2026, is the newest release on the OpenTofu releases page. The project aims for feature parity with Terraform in future releases, but the community decides which features OpenTofu adopts, so compatibility with future Terraform releases is not guaranteed. Docker image tags, Kubernetes Job templates and VM package installs can each drift apart, so store the version in one shared file and check it in CI before every run. Keep the pinned version recorded next to each state backup, and confirm in the release notes whether a binary that has already written state can be rolled back safely.

Which components each model adds to an OpenTofu run

Each model adds the same six components to an OpenTofu run, but the owner and the exposure of each component change with the platform underneath. Read the cards as a checklist of decisions: who runs the job, where state and keys live, how providers reach the runner, and where secrets come from. Confirm each item in your own environment before you compare the three models on cost and effort.

The runner that executes plans

The runner is the process that installs OpenTofu, pulls credentials and runs tofu plan and tofu apply. Docker packages it as a container you build and version yourself, Kubernetes schedules it as a job or pod, and VMs keep it on a host you patch. Confirm which official OpenTofu container images exist and their support window before you standardize, and do not assume a Kubernetes operator is available. Decide who owns the image or host and who approves a tofu version change.

The state backend

The state backend keeps the state file that maps your configuration to deployed resources, and locking is meant to stop two applies from writing the same state at once. On Docker or VMs, a local path is possible but moves backup and access control onto the host. On Kubernetes, state on a persistent volume ties its survival to the cluster. Confirm locking, versioning and restore for the backend you pick. Plan also for configurations that read other stacks through the terraform_remote_state data source, which OpenTofu's migration guide says need extra care.

Migration guide

The state encryption key provider

OpenTofu can encrypt state and plan files at rest, for local storage and remote backends, using a key provider such as PBKDF2, AWS KMS, GCP KMS, OpenBao or Azure Vault. The key provider decides who can decrypt state, so the security team should own it. Each model needs the runner to reach the key service under an identity: a workload identity on Kubernetes, an instance role on a VM, or injected credentials on Docker. Confirm the rotation process and the recovery path if a key is lost.

Feature introduced
v1.7
Encryption docs

Provider and module access

Every run downloads providers and modules, so the runner needs a route to the public OpenTofu Registry or to a mirror you operate. Version pins and lock files matter because a provider update can change a plan without any code change. Air-gapped and restricted networks need a mirror or private registry that the platform team builds and keeps current. Confirm which registry hosts your providers, who approves new modules, and how mirrored content is updated and checked before use.

Providers in Registry
3,900+
Modules in Registry
23,600
OpenTofu website

Git as source of truth

The Git repository holds the HCL, the module versions and the review history, and the runner should only apply what has been merged. Ownership splits: engineering owns the code and module design, while the platform team owns the pipeline that triggers plan and apply. Without approval rules on the main branch, a merge can reach live infrastructure without a second reviewer. Confirm which Git host you use, who can approve an apply, and whether plans are posted to the review before anything runs.

Where secrets come from

Cloud credentials, provider tokens and state encryption keys must reach the runner without appearing in plan output, logs or image layers. Docker usually receives them as environment variables or mounted files, Kubernetes as Secret objects, and VMs from the host or a vault agent. Confirm which store is the system of record, how the runner authenticates to it, and whether secret reads are logged. On Kubernetes, Secret objects are protected at rest only if etcd encryption is enabled, so verify that setting.

Decision path from team shape to deployment model

The path starts with whether the platform team already runs Kubernetes. If it does, Kubernetes runners let the runner live in a cluster the team already operates. If not, the next question is whether the estate sits on a hypervisor. Where it does, ask whether the runner must stay on hosts the team patches itself. If so, VM runners are the outcome. Otherwise, or where no hypervisor exists, Docker runners on managed hosts are the usual fit. Check each outcome against the operating effort covered above, and confirm network reach and state access in your own environment.

Three questions route the team to Docker, Kubernetes or VM runners.

Where high availability comes from in each model

A single OpenTofu runner is a single point of failure for applies, whether it runs as a container on Docker, a pod in Kubernetes or a process on a VM. State itself survives a runner failure because it lives in the remote backend, so a replacement runner can pick up the same configuration once it can reach that backend and its credentials. The more consequential risk is concurrency. When two applies target the same state, the backend's locking decides whether the second run waits, fails or proceeds. Locking behavior differs by backend, so confirm in writing, for your chosen backend, how locks are acquired, how stale locks are cleared and who may break them. Then test a deliberately overlapping apply in a non-production workspace before you rely on it.

If your state backend is a PostgreSQL database that you operate yourself, high availability comes from the database layer. On VMs, one documented option is Patroni, which is MIT licensed, runs PostgreSQL 9.3 to 18 in high availability and keeps its cluster configuration in ZooKeeper, etcd, Consul or Kubernetes. Choose the configuration store your team already monitors, because it becomes another dependency in the failover path. The latest supplied release is Patroni 4.1.5, released August 12, 2026. Confirm with your database team that the PostgreSQL major version you plan to run falls inside the supported range before you pin a version. Patroni documentation covers the configuration store options in detail.

On Kubernetes, the option to evaluate is CloudNativePG, an Apache-2.0 operator in the CNCF Sandbox. It manages PVCs directly instead of StatefulSets and uses the Kubernetes API server for failover without external tools, which removes a separate configuration store from the failover path. The trade-off is that database availability now depends on the health of your cluster and its RBAC settings, so the control plane layout you choose directly affects database failover. The latest supplied release is CloudNativePG 1.30.1, released September 23, 2026. Ask whether the state backend will run inside the same cluster as your runners, because a database in that cluster shares its failure domain with them. CloudNativePG documentation describes the failover behavior.

Upgrades, backups and monitoring for each deployment model

This table compares how each deployment model handles OpenTofu version pinning, upgrades, backups, run and host monitoring, and the in-house skills needed to keep it running. Read each row against your own change control and monitoring, since those existing processes decide how much work each model adds. The main takeaway is that the state, plan, code and key backups are the same in all three models, while the cluster and host skills differ.

AreaDockerKubernetesVMs
Pinning the OpenTofu versionPin a specific image tag or digest in the run definition. Move to v1.13.1 by changing the tag and planning first.Pin the image in the Job or CronJob spec, ideally by digest. Change it through Git so each upgrade is reviewed and can be reverted by commit.Pin the binary version in configuration management or on the host. Upgrades replace the binary, so keep the prior version for fallback.
Testing an upgrade before rolloutRun a read-only plan against a copy of production state before switching the image tag.Test the new image in a non-production namespace with a read-only plan before promoting it.Test the new binary on a staging host with a read-only plan before changing production.
What a backup must includeState, plan files, code and key access. Back up any named volume that holds local state.State, plan files, code and key access. Back up persistent volumes if state or plans are stored in the cluster.State, plan files, code and key access. Back up any local state directory and the host configuration that runs OpenTofu.
Protecting encryption keysKeep passphrases or key references outside the image and volumes. Confirm a restore works with the key alone.Keep key references in a secrets manager or cloud KMS, scoped to the job's service account. Confirm the key provider you chose.Keep key material in a root-only file or a KMS, and record who can read it. Passphrase-based (PBKDF2) state cannot be recovered without the passphrase.
Monitoring runsTrack exit codes and run logs from your scheduler, plus container restarts and failed image pulls.Alert on failed Jobs and missed CronJob runs, and watch pod events for the runner.Alert on cron or systemd timer failures, and keep exit codes from each run in your log system.
Monitoring host healthWatch Docker daemon status, disk use for images and volumes, and host CPU and memory.Watch node readiness, control plane health and persistent volume capacity. Confirm your metrics stack covers these.Watch host CPU, memory, disk, time sync and patch state with your existing monitoring tool.
In-house skillsContainer image handling, volume and secret management, Docker host patching and OpenTofu CLI use.Cluster operations, RBAC, secrets handling, job scheduling and OpenTofu CLI use. Cluster skills are the larger requirement.OS patching, service management, host hardening, backup tooling and OpenTofu CLI use.
RollbackConfirm rollback in your environment: restore the prior image tag and the matching state backup.Confirm rollback in your environment: revert the Git commit and check the state backup against it.Confirm rollback in your environment: reinstall the prior binary and check the state backup against it.

Which team each deployment model suits

A small platform team with no cluster usually wants the shortest path from a Git repository to a working OpenTofu runner. Running OpenTofu in Docker on one or a few hosts keeps the control plane small enough for a few people to understand and patch. The trade-off is that the team owns every host-level failure, so the design has to make the hosts easy to replace.

  • Small surface area: a container host, a container runtime and the runner image make up most of the stack, so there is little to patch beyond them.
  • Replaceable hosts: keep state in a remote backend with encryption configured, so a rebuilt host can resume work without relying on local state.
  • Pinned images: pin the OpenTofu version in the runner image, for example v1.13.1, and upgrade on a schedule the team has tested.
  • Single failure domain: one host means runs stop during host maintenance or failure, which is acceptable only if pipelines can wait.

This model is the wrong choice when several teams need isolated runners, or when runs cannot pause during host maintenance. Automatic rescheduling on Kubernetes or a highly available pair of VMs then fits better, and the small-team advantage disappears.

Confirm where state and plan files are stored, who can restart a failed runner, and how long a host rebuild takes in your own environment.

Moving an OpenTofu runner to a new model without rewriting configuration

This sequence moves an existing OpenTofu setup from one runner model to another, such as Docker, Kubernetes or virtual machines, with the configuration code left as it is. It ends only when a plan shows no unexpected changes and the new runner has taken over applies. Each step names the check that closes it, so a stalled move can be paused or rolled back.

  1. Inventory runners, state backends and secrets

    The platform team lists every OpenTofu runner, including the container image, cluster namespace or virtual machine that hosts it, and every configuration it runs. For each configuration, record the state backend and its location, the workspaces in use, the provider credentials and the variables injected at runtime. Confirm which pipeline triggers each runner. The step is done when a reviewer can point to one owner, one backend and one runner for every configuration, and no configuration is left unassigned.

  2. Pin the OpenTofu version on both runners

    Choose one exact OpenTofu release for the move and set it on the current runner and the new one. OpenTofu v1.13.1 was released on October 1, 2026, but check the releases page for a newer patch before you choose. Commit the .terraform.lock.hcl file so provider versions are fixed too. If the code was first written for Terraform, record which Terraform version it targets, because OpenTofu aims for feature parity but does not guarantee compatibility with future Terraform releases. The step is done when both runners report the same OpenTofu version and the lock file matches the committed copy.

  3. Back up state, code and encryption keys

    The platform team copies each state file from its backend, keeps the version history the backend provides, and tags the commit of the configuration repository that the move starts from. For configurations using state encryption, record the key provider settings and make sure the key material is backed up under the same controls as the state. Restore one copy into a scratch location and run tofu state list against it. The step is done when the restore works, the tagged commit exists, and someone other than the author has confirmed where the keys are held.

  4. Stand up the new runner without applying

    Build the runner on the chosen model, whether a Docker host, a Kubernetes namespace or a virtual machine. Give it the same OpenTofu version, a network path to the state backend and access to the providers the configurations use. Load secrets through the store the organization already audits, and keep them out of images and shell history. Run no apply on this runner yet. The step is done when tofu version reports the pinned release, a read of the state succeeds from the new runner, and no state has been written.

  5. Run init and a clean plan

    On the new runner, run tofu init against each configuration using the committed lock file, then run tofu plan against the live state and save the plan output. Expect no changes, or only changes you can trace to a known cause. Differences caused by runner paths, environment variables, workspace names or credentials are blockers, so fix the runner and do not apply the plan. Store the reviewed plan with the change record. The step is done when every configuration shows a clean plan and a second reviewer has signed off on the saved output.

  6. Check configurations that share outputs

    Find every configuration that reads another configuration's outputs through terraform_remote_state. OpenTofu's migration guide warns that configurations sharing data this way typically need additional care during migration, and it links a separate guide for that case. Plan producer and consumer configurations together, and agree the cutover order so no consumer reads outputs from a state that has moved. The step is done when each producer and consumer pair has a clean plan on the new runner and the order is written down.

  7. Cut over and keep rollback ready

    Point the pipeline triggers at the new runner in one change, and remove apply permissions from the old runner so that only one runner can write to each state. Run the first change from the new runner and confirm it matches the saved plan. Keep the old runner, its configuration and the state backup available until the team has run ordinary changes through the new runner without problems, because the migration process is designed to be safe and reversible. The step is done when the first change matches its saved plan, the old runner can no longer apply, and a named owner holds the rollback steps.

How much effort, time and cost does hosting OpenTofu take

What drives the cost of hosting OpenTofu on Docker, Kubernetes or VMs?

Most of the cost sits in people time around OpenTofu, because the software is MPL-2.0 licensed and carries no license fee. Split the spending into one-time work (design, state backend setup, key provider integration, pipeline build) and recurring work (upgrades, patching, restore tests and runner upkeep). The drivers differ by model:

  • Docker: the container host, the image build pipeline and how many runner containers you keep current.
  • Kubernetes: cluster capacity, control plane upkeep and the operators and policy tools your platform team maintains.
  • VMs: host count, the OS patch cycle and the configuration management that keeps each runner identical.

Cost rises with the number of teams, workspaces and environments sharing a runner, and with audit trail requirements. Ask for each recurring item to appear as its own line in the quote.

Can a platform team run OpenTofu itself without outside help?

Yes, if your team already runs Git, a CI runner and a secrets or key service, and has an owner for state and upgrades. The skills needed are HCL and module design, state locking and backend operations, key management for encryption at rest, and runner security. OpenTofu's state encryption supports key providers such as PBKDF2, AWS KMS, GCP KMS, OpenBao and Azure Vault, so you must pick one, operate it and test recovery before go-live. Outside help matters most in three places: the initial design, the first cutover and the first upgrade cycle after go-live. If nobody can cover runner on-call, plan for a retainer or a managed option. Run a short skills review against this list before you decide to build in-house.

What access and ownership does OpenTofu hosting require from my team?

Your team must own, or hold named administrator control over, four things: the state backend, the key provider, the Git repositories and the CI runners. Backend access means the storage or database holding state and plan files, plus permission to lock, restore and audit them. The key provider holds the keys that encrypt state, so decide who can read, rotate and revoke those keys before go-live. Git ownership covers branch protection, review rules and which module and provider sources are approved. Runner ownership covers the runner image, its credentials, its network path and its logs. Ask the partner which of these it will operate during the engagement and which transfer to your team at handover.

How long does an OpenTofu hosting engagement take to deliver?

The timeline comes from the written scope, which is agreed in writing before work starts, and most engagements are fixed-scope. The main inputs are the number of environments, the state backends to set up or migrate, the number of pipelines and runners, the identity and key provider integrations, and the testing and documentation your compliance team needs. Migration adds effort when configurations use the terraform_remote_state data source, which OpenTofu's migration guide flags for extra care. Your own availability for design reviews and access approvals also sets the pace. Ask for milestones with a named deliverable and an acceptance test for each, so progress can be checked against the scope.

Is Docker a supported way to run OpenTofu, and who supports it?

Whether Docker is supported depends on what the OpenTofu project publishes, so confirm it before you design around a container. Check the OpenTofu releases page and the documentation for an official container image, the tags it publishes and any statement on running it in containers. If the image is built by someone else, patching, rebuilds and vulnerability response move to that publisher, so record who owns each image version. Docker suits runners that pull a pinned release, but the container host, registry and secret injection still need a named owner. DeployOpen can plan and implement a container-based runner inside your infrastructure. Support terms for any image come from its publisher, so get them in writing.

What should I request in a written quote for OpenTofu hosting?

Ask for a quote that names each deliverable, the environments in scope and the runner model you chose (Docker, Kubernetes or VMs), with the reason for that choice. Require separate line items for design, state backend and key provider setup, identity and Git integration, runner build, migration of existing code, testing, documentation and handover. Mark which items are one-time and which recur, such as upgrades, backup restore tests and retainer support. Ask which assumptions the estimate depends on and what changes it, such as new environments or added state backends. Request acceptance criteria for each milestone and the named people who will do the work. DeployOpen does not publish a price list, so a quote follows from the written scope.

How DeployOpen scopes and runs OpenTofu hosting work

DeployOpen treats the choice between Docker, Kubernetes and virtual machines as a scoping question before it is a tooling question. We plan, implement, integrate, harden, back up, upgrade, document and support self-hosted platforms inside your own cloud accounts, data centers or air-gapped networks. The OpenTofu code that provisions each target is included in that written scope.

How we scope

  • The written scope names which of Docker, Kubernetes or virtual machines you are running OpenTofu against, and why.
  • Engagements are fixed-scope: scope, deliverables and timelines are agreed in writing before work starts.
  • Ask that the state backend, network paths and sizing assumptions appear in the scope document.

How we build

  • Provisioning code for the chosen target is written in OpenTofu and reviewed before it touches production.
  • Configure state and plan encryption from day one, with a key provider your security team has approved.
  • Each target gets its own runbook, since Docker hosts, Kubernetes clusters and VMs back up and upgrade differently.

How we hand over

  • Handover includes the OpenTofu code, configuration, runbooks and the backup and upgrade procedures for your chosen target.
  • Documentation covers the hosting decisions made during scoping, so your architecture and compliance reviewers can trace them.
  • Teams moving from Terraform can follow OpenTofu's migration guide, with extra care for terraform_remote_state.

How we support

  • Support is available as a retainer for upgrades, ongoing operations and continuous testing after handover.
  • Upgrades are scoped as part of a retainer, including OpenTofu release changes such as those in v1.13.1.
  • Ask any support provider how they handle Terraform compatibility, since OpenTofu does not guarantee compatibility with future Terraform releases.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.