XenonStack

Deployment Automation

XenonStack Insights Terraform Infrastructure as Code: Enterprise Guide

and | Published | Updated

Terraform for enterprise teams: versioned configuration, remote locked state, plan review and governed change

Key takeaway

  • Terraform explained for enterprise leaders: plan and apply, remote state, licensing and OpenTofu, IBM ownership, and how to govern infrastructure changes.

What is Terraform, and what does it do for an enterprise?

Terraform is an infrastructure as code tool. According to HashiCorp's introduction, it lets you define cloud and on-premises resources in configuration files that you can version, reuse and share, and it manages both low-level components such as compute, storage and networking and high-level ones such as DNS entries and SaaS features. For a CTO or platform lead, the value is a reviewable, repeatable record of what infrastructure should exist, instead of settings held in people's heads or in console clicks. This guide sits alongside our overview of infrastructure as code and our comparison of IaC tools.

The decisions that matter at enterprise scale are not syntax. They are where state lives, who approves a plan, which licence and distribution you build on (Terraform or OpenTofu), and how changes proposed by people or by AI agents are governed. This post covers each of those, with sources.

How does Terraform work?

Terraform follows a write, plan, apply workflow. You write resources, which can span several providers. Terraform then builds an execution plan describing what it will create, change or destroy, based on your configuration and the infrastructure that exists. After you approve, it carries out the operations in dependency order. Providers are the plugins that let Terraform talk to a platform's API, and HashiCorp's page says they enable Terraform to work with virtually any platform or service that has an accessible API (source: developer.hashicorp.com/terraform/intro).

Two-column diagram pairing Terraform workflow stages (write, plan, apply, state) with controls: version control and lock file, named approver, policy and audit trail, remote locked backend.
ConceptWhat it doesWhy a leader should care
ConfigurationDeclares the resources you want, in files you can version and shareInfrastructure changes go through code review like any other change
PlanShows what will be created, changed or destroyed before anything happensA natural approval gate for risky changes
ApplyPerforms the approved operations in dependency orderRepeatable execution, with fewer manual steps
ProviderConnects Terraform to a cloud or service APIOne workflow across several platforms
StateRecords the real infrastructure Terraform managesThe file that decides what the next plan will change

Why does Terraform state matter, and where should it live?

State is how Terraform knows what it manages. HashiCorp describes the state file as a source of truth for your environment that Terraform uses to work out the changes needed to match your configuration. By default it is stored locally in terraform.tfstate, which the documentation notes becomes unwieldy for teams. Remote state stores it in a shared data store such as HCP Terraform, Amazon S3, Azure Blob Storage or Google Cloud Storage, and fully featured remote backends can lock state to stop concurrent runs against the same state (source: developer.hashicorp.com/terraform/language/state/remote).

For teams on AWS, the S3 backend documentation says state locking is opt-in, enabled with use_lockfile, and that DynamoDB-based locking is deprecated and will be removed in a future minor version. It also strongly recommends enabling bucket versioning so state can be recovered after accidental deletion or human error (source: developer.hashicorp.com/terraform/language/backend/s3). Check the current page before you standardise, because backend options change between releases.

terraform {
  backend "s3" {
    bucket       = "example-state-bucket"
    key          = "path/to/my/key"
    region       = "us-east-1"
    use_lockfile = true
    encrypt      = true
  }
}

Provider versions need the same discipline. The dependency lock file, .terraform.lock.hcl, records the exact provider versions chosen at terraform init, and HashiCorp's tutorial advises including it in version control so everyone uses the same versions. Without it, Terraform installs the latest version that satisfies your constraints, which can cause unexpected infrastructure changes (source: developer.hashicorp.com/terraform/tutorials/configuration-language/provider-versioning).

Terraform or OpenTofu: what has changed in licensing and ownership?

Two facts affect procurement and legal review. First, Terraform's source is licensed under the Business Source License 1.1 from version 1.6.0, with IBM named as licensor and a change licence of MPL 2.0 four years after each version is published (source: the LICENSE file in the hashicorp/terraform repository). Second, IBM announced on 27 February 2025 that it had completed its acquisition of HashiCorp, and said Terraform and the rest of the portfolio are offered through IBM's automation software portfolio (source: IBM newsroom).

OpenTofu is a fork created in response to the licence change. Its FAQ says it is hosted as a Linux Foundation project, aims for feature parity with Terraform, works with existing state files created by Terraform versions up to 1.5.x, and uses its own registry. Its repository licence is MPL 2.0. OpenTofu also documents state and plan encryption at rest as a feature of its own (sources: opentofu.org/faq, opentofu.org/docs/language/state/encryption, github.com/opentofu/opentofu).

QuestionTerraformOpenTofu
Source licenceBusiness Source License 1.1 from 1.6.0, licensor IBMMPL 2.0
StewardHashiCorp, now part of IBMLinux Foundation project
RegistryTerraform RegistrySeparate registry at search.opentofu.org
State encryptionConfirm on the official pageDocumented, with several key providers

The licence terms and the "additional use grant" are legal matters. HashiCorp's licence FAQ is the place to read the restrictions, and your counsel should decide whether your use is covered. Confirm on the official page before committing to either distribution.

How does Terraform compare with Ansible, CloudFormation and other tools?

Terraform provisions infrastructure; configuration management tools configure what runs on it. IBM's completion announcement describes the pairing in those terms: Terraform for foundational infrastructure across clouds, and Red Hat Ansible Automation Platform for configuring applications and middleware on top. See our Ansible guide for the configuration side. If you work on one cloud only, the native tool may be enough: our AWS infrastructure as code guide covers CloudFormation and CDK, and our GCP guide covers Google Cloud. Terraform earns its place mainly when you manage several providers or want one workflow across teams.

Which Terraform practices should leaders insist on?

  • Remote, locked, encrypted state. Never leave state on a laptop for a shared environment.
  • A committed lock file and pinned provider constraints. This keeps runs consistent between engineers and pipelines.
  • Plan review before apply. Treat the plan as the change record, and route sensitive changes to a named approver.
  • Import blocks for existing infrastructure. HashiCorp's documentation says an import block, with a matching resource block, brings existing resources under management as code (source: developer.hashicorp.com/terraform/language/import).
  • Replace instead of taint. The terraform taint command is deprecated; HashiCorp recommends terraform apply -replace, so the replacement shows in the plan before you act (source: developer.hashicorp.com/terraform/cli/commands/taint).
  • Modules for reuse. Shared modules let product teams self-serve approved patterns instead of copying configuration.

How do you govern Terraform changes made by people and AI agents?

Plans and pipelines tell you what will change. They do not record why a change was approved, under which policy, or by whom. As agents begin to propose infrastructure changes, that missing record becomes a risk. ElixirData keeps governed context, versioned policy and decision traces in one decision layer above AI agents, and AgentGRC keeps autonomous agent actions inside policy, with the audit trail risk teams need. For building and orchestrating agents with humans in control, see ElixirClaw. Our IaC security guide and IaC in the CI/CD pipeline post cover the controls around the pipeline itself.

What is a sensible adoption sequence, and when should you not use Terraform?

  1. Choose the distribution (Terraform or OpenTofu) with legal and procurement input.
  2. Set up remote state, locking and encryption before the first shared environment.
  3. Start with one well-understood service and one provider, with plan review in your pipeline.
  4. Import existing resources gradually, one boundary at a time.
  5. Publish approved modules and add policy checks before widening access.

Terraform is a poor fit when the estate is a handful of resources on a single cloud that its native tool already manages well, or when no one owns state and reviews. In those cases the tool adds process without adding control. It is also not a replacement for configuring software inside servers, which is the job of tools such as Ansible.

To map one infrastructure decision your agents should make, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.

Frequently asked questions

What is Terraform used for?

It defines cloud and on-premises infrastructure in versioned configuration files and applies changes through a plan and apply workflow, across providers that expose an API.

What is Terraform state and why is it important?

State records the infrastructure Terraform manages and is used to work out what must change to match your configuration. Teams should keep it in a remote backend with locking.

Is Terraform open source?

From version 1.6.0 its source is under the Business Source License 1.1, with a change licence of MPL 2.0 after four years. OpenTofu, a fork, is MPL 2.0. Confirm the terms on the official pages.

Who owns Terraform now?

IBM announced on 27 February 2025 that it had completed its acquisition of HashiCorp, the creator of Terraform.

Should I use Terraform or OpenTofu?

Both work with the plan and apply model. Decide on licence terms, ecosystem and support, and test your providers and state before switching.

How does Terraform differ from Ansible?

Terraform provisions infrastructure, while Ansible configures applications and middleware on top of it, as IBM describes the pairing.

Table of Contents

navdeep-singh-gill

Navdeep Singh Gill

Global CEO and Founder of XenonStack

LinkedIn profile

Navdeep Singh Gill is serving as Chief Executive Officer and Product Architect at XenonStack. He holds expertise in building SaaS Platform for Decentralised Big Data management and Governance, AI Marketplace for Operationalising and Scaling. His incredible experience in AI Technologies and Big Data Engineering thrills him to write about different use cases and its approach to solutions.

Get the latest articles in your inbox

Subscribe Now

Interested in Solving your Challenges with XenonStack Team
Get Started

Get Started with your requirements and primary focus, that will help us to make your solution

Please Select your Industry
Banking
Fintech
Payment Providers
Wealth Management
Discrete Manufacturing
Semiconductor
Machinery Manufacturing / Automation
Appliances / Electrical / Electronics
Elevator Manufacturing
Defense & Space Manufacturing
Computers & Electronics / Industrial Machinery
Motor Vehicle Manufacturing
Food and Beverages
Distillery & Wines
Beverages
Shipping
Logistics
Mobility (EV / Public Transport)
Energy & Utilities
Hospitality
Digital Gaming Platforms
SportsTech with AI
Public Safety - Explosives
Public Safety - Firefighting
Public Safety - Surveillance
Public Safety - Others
Media Platforms
City Operations
Airlines & Aviation
Defense Warfare & Drones
Robotics Engineering
Drones Manufacturing
AI Labs for Colleges
AI MSP / Quantum / AGI Institutes
Retail Apparel and Fashion

Proceed Next