1. Learn
  2. Align
  3. Perform
  4. Review

Review10 min read

How Humans Break Terraform Deployments: A Cautionary Tale

By J Damien Scott, Trusted Advisor

Infrastructure as Code has changed how organizations provision cloud resources. Terraform enables repeatable, auditable deployments. But human operators break it in predictable ways. This article maps ten common failure patterns to GRC control gaps, providing both practitioners and governance professionals a shared framework for closing them.

Introduction

Infrastructure as Code (IaC) has changed how organizations provision and manage cloud resources. Terraform, HashiCorp's orchestration tool, enables teams to define complex cloud infrastructure declaratively, place it under version control, and deploy it consistently across environments. For governance, risk, and compliance (GRC) professionals, Terraform functions as a critical control point: infrastructure changes become auditable, repeatable, and aligned with security policy.

Terraform's power introduces new failure modes. The tool itself is robust. Human operators, however, can break deployments in ways that compromise security, inflate costs, corrupt audit trails, and erode organizational resilience. This article examines the most common failure patterns, explains the mechanism of each failure, and provides prevention and remediation guidance. Each failure maps to a control gap that a GRC program should address.

These failures are not defects in Terraform. They are organizational, procedural, and technical failures that exploit gaps in governance, knowledge, and architectural safeguards.

1. State File Deletion

Terraform maintains a state file that tracks resource identifiers, dependencies, outputs, and metadata. Deleting or losing the state file causes Terraform to lose its record of what exists in the cloud. This happens when an engineer clears a local directory without realizing state is stored there, or when an administrator deletes the S3 bucket holding remote state to reduce costs.

Prevention centers on protecting state as critical infrastructure: use a remote backend with versioning enabled, enable object versioning on the state bucket, restrict bucket access with a policy and access logging, and use state locking through DynamoDB to prevent concurrent modifications. This maps to data integrity and availability controls in any GRC framework.

2. Manual Console Changes and Drift

Drift occurs when someone modifies a cloud resource through the web console, an API call, or an ad hoc script, bypassing Terraform. A security team may patch a security group rule during an incident. A compliance officer may adjust an IAM policy to grant contractor access. Terraform's next plan detects the divergence and, depending on how the team responds, may silently revert the manual change on the next apply.

Prevention requires removing the ability to make manual changes: restrict IAM permissions so that only the Terraform deployment role can write infrastructure, and deploy cloud configuration monitoring such as AWS Config to detect drift automatically. This maps to change management controls.

3. Hardcoded Secrets

Sensitive values such as access keys, API tokens, and database passwords written directly into Terraform files or variable files and committed to git are compromised permanently, even if a later commit removes them. Automated systems scan public repositories continuously for exposed credentials, and discovery occurs within minutes.

Prevention begins with never placing secrets in code. Prefer short-lived IAM roles over long-lived access keys. Store secrets in a dedicated secret manager. Install a pre-commit scanner so that a commit containing a credential pattern fails before it reaches the remote. This maps to access control and key management controls.

4–6. Variable Mistakes, Accidental Destruction, and Permission Failures

Variable mistakes send infrastructure to the wrong destination: wrong region, wrong environment, wrong account. Prevention relies on explicit variable names, separate variable files per environment, and validation blocks that reject invalid values before deployment begins. Isolate environments in separate accounts so a variable error cannot cross an account boundary.

The terraform destroy command can delete every resource in a configuration with a single command. Prevention layers several controls: never use automatic approval for destroy operations in a pipeline, protect critical resources with a lifecycle prevent_destroy guard, and use service control policies to deny destructive API calls from non-administrative roles. Credentials expire and permissions change; verify the active identity and its permissions before deployment and rotate credentials on a schedule.

7–10. Backend Misconfiguration, Dependencies, Concurrency, and Version Drift

If the S3 bucket holding state is deleted or the KMS key protecting state is removed, Terraform cannot read or write state and all operations fail. Protect the backend as critical infrastructure: enable versioning and encryption, restrict deletion through a bucket policy, and treat the KMS key as a protected resource.

Terraform models resources as a directed acyclic graph. A cycle cannot be resolved. Without a DynamoDB lock, two operators running Terraform simultaneously produce state corruption. Upgrading the Terraform binary or provider plugin can change syntax expectations. Pin versions in the configuration and commit the provider lock file so every operator and pipeline resolves identical versions.

Governance Perspective

Each failure above maps to a control gap that a GRC program should address: state protection maps to data integrity and availability; drift prevention maps to change management; secret handling maps to access control and key management; environment isolation maps to segregation of duties; destruction safeguards map to business continuity; permission verification maps to least privilege; backend protection maps to configuration management; dependency discipline, concurrency control, and version pinning map to release management.

A mature IaC governance program treats infrastructure code as a governed artifact, subject to the same review, approval, access control, and audit requirements as any other change that affects the organization's security posture. The ten failures in this article are not edge cases. They are predictable outcomes of governance gaps that every organization using IaC should close before they become incidents.

GRC & OperationsIaC GovernanceTerraformAWSCloud GRCChange Management

Field Notes · by email

One email when a new article publishes. Nothing else.

Field notes on converged security from J Damien Scott, Trusted Advisor: the article, its summary, and the phase it belongs to. No digests, no offers, no third party reading over your shoulder.

Email delivery is being set up. The feed carries every article the day it publishes. About Field Notes

Related reading

All articles

Review · 11 September 2026

Post Coverage Is a Protective Audit, Not a Finance Task

An unfilled post is an unprotected site, and the record that proves the post was filled is the same record that bills the client. Redesigning timekeeping controls, billing reconciliation, contract compliance, post coverage validation, and exception review cut revenue leakage by 95% at a 127-account security enterprise. The finance result was real. The protective result was larger, and it is the one most security leaders never claim.

5 min read

Review · 10 September 2026

The After-Action Review Is Where Review Happens

Exercises produce findings. After-action reviews produce change, and only when the corrective action has an owner, a date, and a place in the next plan. Four conflict-affected operating environments, two country evacuations, and a post-earthquake recovery taught what a rigorous after-action review looks like, who has to own what comes out of it, and how findings feed threat intelligence rather than a filing cabinet.

5 min read

Review · 9 September 2026

Three Numbers a Protective Program Must Report

Activity counts are not measures. A protective program that reports patrols completed and alerts reviewed is describing effort, and effort is not what leadership is paying for. Three numbers describe effectiveness: detection time, response time, and mitigation effectiveness. Each needs a defined clock and a defined denominator, or the number is theatre. This article sets out how each was defined and moved in practice.

5 min read