Infrastructure as Code with Terraform: A Practitioner's Guide for 2026
When 84% of organizations deploying infrastructure through code are still shipping unencrypted storage and 80% lack logging in their IaC-managed environments, the promise of "consistent, auditable infrastructure" starts looking like marketing copy. Infrastructure as Code with Terraform has gone mainstream — but most implementations remain dangerously immature.
This isn't a tutorial. If you're still deciding whether to adopt IaC, you're already behind. This is about doing it right: navigating the Terraform/OpenTofu split, avoiding the security pitfalls that plague most deployments, and building a foundation that actually delivers on the promises.
Why Terraform Adoption Has Outpaced Terraform Maturity
89% of teams have adopted infrastructure as code, but only 6% report full coverage. That 83-point gap isn't laziness — it's operational reality. Version management is the hidden challenge: breaking changes in major providers cause significant operational overhead.
As of 2026, Terraform supports over 3,000 providers through its public registry, making it the most broadly compatible IaC tool available. That breadth is both Terraform's strength and its operational tax. Multi-cloud is common — organizations run an average of 2.4 public cloud providers — so multi-provider configurations are the norm, and provider sprawl is real. Large estates accumulate dozens of provider configurations across workspaces.
The practical consequence: most teams write Terraform for their core infrastructure, then abandon it for edge cases. The result is hybrid environments where some resources are managed, some are ClickOps, and drift becomes invisible until it causes an incident.
The Terraform vs. OpenTofu Decision: What Actually Matters
In August 2023, HashiCorp changed Terraform's license from MPL to BSL. In December 2024, IBM bought HashiCorp for $6.4 billion. And quietly, 12% of IaC practitioners switched to OpenTofu.
OpenTofu is the MPL 2.0-licensed fork of Terraform, governed by the Linux Foundation and accepted into the CNCF in April 2025. As of June 2026, the current stable release is v1.12.2.
Here's what actually matters for SMBs:
Stay with Terraform if: You're using HCP Terraform features like Sentinel policies, Stacks, or no-code modules. Stacks-using teams generally stay on Terraform; teams using Sentinel typically replace it with OPA when migrating.
Consider OpenTofu if: You want licensing clarity for the long term. The BSL forbids building competing products on top of Terraform, OpenTofu does not, which is why every managed IaC platform — Spacelift, env0, Scalr, Gruntwork — defaulted to OpenTofu within months of the relicense.
The two projects have visibly diverged: state encryption, ephemeral values, early variable evaluation, and provider for_each ship in OpenTofu first and have no Terraform equivalent in 2026.
The migration itself is straightforward for most teams. Migration is a binary swap: brew install opentofu, tofu init -upgrade, tofu plan, done. State files are interchangeable as long as you don't turn on OpenTofu-only features.
IaC Security: Where Most Implementations Fail
The Orca 2026 State of Application Security Report paints an ugly picture. 75% of organizations manage infrastructure through code, yet 84% deploy unencrypted storage and 80% lack logging in IaC-managed environments. Overly permissive IAM roles and open network rules are frequently embedded in templates, allowing insecure configurations to be deployed repeatedly across production systems.
This is the IaC paradox: the same automation that enables consistent deployment also enables consistent misconfiguration at scale. A bad Terraform module doesn't create one vulnerable S3 bucket — it creates dozens across every environment.
Unprotected Terraform state files expose sensitive infrastructure information to unauthorized access. State files contain detailed configuration data, resource identifiers, and sometimes sensitive values like passwords or private keys. When stored in unencrypted storage, shared through insecure channels, or accessible to unauthorized users, state files provide attackers with a complete map of your infrastructure and potential credentials for accessing it.
Minimum viable security posture:
- State encryption. If you're on OpenTofu, enable client-side state encryption. On Terraform, use an encrypted backend (S3 with SSE-KMS, Azure Blob with CMK).
- No secrets in code. Use Vault, AWS Secrets Manager, or environment variables at runtime. Scan your repos with tools like Checkov or tfsec.
- Least-privilege service accounts. The Terraform service principal should not have Owner/Admin permissions. Use scoped roles per workspace.
- Audit your modules. Public modules from the registry are convenient but unvetted. Fork critical modules and maintain them internally.
What Terraform 1.17 Brings (And Why It Matters)
Terraform releases 1.17.0-rc2 with Terraform Policy now generally available, new provider requirement variables and locals, and a minimal-refresh planning option.
Terraform Policy is now generally available. The -policies flag for plan, apply, and query no longer requires an experimental build. Query policies evaluate resources discovered by list blocks and report human-readable or JSON results.
The minimal-refresh option is a significant operational improvement for large estates. A new -minimal-refresh planning option has been added, which will only refresh resources that have proposed changes. If you've ever waited 15 minutes for a plan to refresh 500 resources when you're changing one, this feature alone is worth the upgrade.
Terraform now supports variables and locals in provider requirements. This enables patterns that were previously impossible without wrapper scripts — like dynamically selecting provider versions based on environment or using shared provider configurations across modules.
A Representative Case: Mid-Size SaaS Company Migration
A 200-employee SaaS company running on AWS came to us with familiar pain: three years of accumulated Terraform configurations, inconsistent module versions across environments, secrets in plaintext across 40+ state files, and a single engineer who understood how it all connected.
The fix wasn't a rewrite. It was remediation:
- Week 1: Audit and inventory — mapped all workspaces, identified state backends, catalogued secrets in code
- Week 2-3: Security hardening — migrated state to encrypted S3 with DynamoDB locking, rotated all exposed secrets, implemented pre-commit hooks with tfsec
- Week 4-5: Standardization — consolidated to three environment-specific module versions, established promotion workflow from dev → staging → prod
- Week 6: Documentation and handoff — runbooks for common operations, on-call rotation for infrastructure changes
Total time to production-grade IaC: six weeks. The alternative — rebuilding from scratch — would have taken six months and introduced regression risk.
Key Takeaways
- IaC adoption without security hardening is liability multiplication. 84% of IaC-managed environments ship with unencrypted storage. Don't be a statistic.
- The Terraform/OpenTofu decision is about licensing risk, not features. For most SMBs, either works. Pick based on your vendor relationships and procurement team's comfort level.
- State file security is non-negotiable. Encrypt at rest, restrict access, enable versioning. Your state file is a roadmap for attackers.
- Don't rewrite — remediate. Most Terraform implementations can be hardened in weeks, not months. Start with secrets and state.
If your infrastructure-as-code practice is stuck in the "adopted but not mature" gap, Afocal's Managed DevOps team can help you close it — whether that means security remediation, migration planning, or building the CI/CD pipelines that make IaC actually sustainable.
Want to learn more about how Afocal can help your business?
Book a Free Audit