TL;DR: Infrastructure as code has moved from automation utility to enterprise control plane, where security, policy-as-code, drift detection, and secrets handling determine whether deployments stay auditable and resilient, according to Apiiro. The governance challenge is no longer choosing a tool, but proving that code-to-runtime controls can keep pace with multi-tool IaC sprawl.
At a glance
What this is: Apiiro argues that infrastructure as code now sits at the centre of enterprise governance, with security, drift control, and policy enforcement deciding whether IaC remains auditable and resilient.
Why it matters: This matters because IAM, security, and platform teams increasingly depend on code-defined infrastructure to enforce access, compliance, and change control across cloud environments.
Context
Infrastructure as code turns infrastructure changes into reviewable code, but that also creates a governance problem if the code and the live environment diverge. The control gap is not automation itself, it is whether policy, secrets, and drift controls are strong enough to keep the declared state and runtime state aligned.
In modern DevSecOps environments, IaC intersects directly with identity and access management because deployment pipelines, state backends, and orchestration tools all depend on credentials and permissions. Once infrastructure is defined as code, the governance question becomes who can change it, how those changes are validated, and whether unauthorized drift can be detected before it affects production.
Key questions
Q: What breaks when infrastructure policy checks happen only after deployment?
A: When policy checks are delayed until after deployment, teams discover misconfigurations after the environment is already live. That increases the chance of outages, rework, and compliance violations. It also creates a heavier operational burden because engineers must unwind bad changes instead of stopping them at the point of submission.
A: Configuration drift creates risk because infrastructure no longer matches the approved source of truth. When teams change resources directly through a console or CLI, the deployed state can diverge from code, which weakens governance, hides misconfigurations, and can introduce vulnerabilities. Over time, the gap makes deployments less predictable and makes troubleshooting slower and more expensive.
Q: What do teams get wrong about secrets management in pipelines and scripts?
A: They often treat the vault as the finish line. In practice, a secret can be copied into code, tickets, chat tools, and automation jobs, which means governance must include discovery, removal, and proof of cleanup. Rotation alone does not fix duplicate exposure.
Q: How should organisations govern multiple IaC tools without losing control?
A: They need a governance layer that sits above individual engines and applies the same rules across provisioning, configuration, and orchestration platforms. That means unified policy enforcement, shared audit trails, and common drift visibility. A fragmented approach leaves each tool operating as its own control island, which is where consistency breaks down.
Technical breakdown
Why infrastructure as code changes the governance model
Infrastructure as code replaces ad hoc provisioning with declarative definitions that can be versioned, reviewed, and tested. That shifts governance upstream: instead of auditing isolated console changes after the fact, teams can enforce policy before deployment and compare runtime state against source truth continuously. The technical strength of IaC is repeatability, but that same repeatability also means a bad template or insecure module can be propagated at scale. In practice, the security model depends on controls around review, testing, state protection, and policy enforcement, not just the provisioning engine itself.
Practical implication: govern IaC like software delivery, with code review, policy checks, and state protections before anything reaches production.
How policy-as-code and scanning work together
Policy-as-code turns governance rules into machine-enforced checks, while static scanning inspects templates for insecure configurations before deployment. The two controls solve different parts of the same problem. Scanning finds issues such as public exposure, weak encryption, or unsafe defaults in the declared infrastructure, and policy engines decide whether the change can proceed at all. Used together, they move security from manual review to enforced guardrails embedded in CI/CD. The important detail is that these controls only work if they are early, consistent, and tied to the approval path rather than added as a downstream audit step.
Practical implication: place IaC scanning and policy enforcement in the merge path, not as a post-deployment cleanup activity.
Why drift detection is now an operational control
Drift detection compares the deployed environment with the code baseline to identify unauthorized or unplanned change. In cloud environments, drift often emerges from emergency fixes, manual console edits, or inconsistent multi-tool workflows, and those changes can quietly defeat the assumptions in the source repository. From a governance perspective, drift is not just configuration noise. It is evidence that the approved control model no longer matches reality. That matters for auditability, recovery, and trust in the pipeline because teams cannot govern what they cannot reconcile. The control objective is continuous alignment between declared infrastructure and live state.
Practical implication: treat drift as a control failure signal and automate reconciliation before the divergence becomes the new normal.
NHI Mgmt Group analysis
IaC governance has become a security discipline, not a deployment preference. The article shows that the main risk is no longer whether teams automate infrastructure, but whether the automation itself is governed. Once infrastructure definitions become the source of truth, the quality of policy, review, and state management determines whether the environment remains trustworthy. Practitioners should treat IaC governance as part of the security control plane, not a tooling side effect.
Drift is the most important operational symptom in mature IaC environments. The article makes clear that the declared state and the runtime state can diverge even when teams believe they are managing everything through code. That gap breaks auditability and weakens incident recovery because the live environment no longer matches approved intent. Configuration drift: this is the specific failure mode where the running environment departs from source-controlled definitions, and it demands continuous reconciliation rather than periodic review. Practitioners should measure how quickly they can detect and close that gap.
Secrets handling now sits inside infrastructure governance. The article ties IaC maturity to secret management, encrypted state storage, and short-lived credentials, which means access control is no longer just about human admins. Deployment pipelines, orchestration layers, and remote state all create non-human access paths that must be governed as identities. This is where the identity and IaC disciplines converge most clearly. Practitioners should govern pipeline and platform credentials with the same discipline they apply to privileged human access.
Multi-tool IaC sprawl forces governance to move above individual engines. Enterprises rarely run one provisioning or configuration system, so the practical problem is consistency across Terraform, OpenTofu, Pulumi, cloud-native tooling, and orchestration layers. The market direction is toward control planes that unify policy, state visibility, and audit trails across heterogeneous stacks. That validates integrated governance models and complicates narrow point-tool approaches. Practitioners should evaluate whether their governance layer can span the whole IaC estate, not just one engine.
Code-to-runtime assurance is the real maturity threshold. The article repeatedly points to the need to link source code, deployment workflows, and live infrastructure. That is the difference between documented compliance and actual control. For security teams, the question is not whether IaC exists, but whether they can prove that the runtime state still reflects approved code after deployment and change. Practitioners should build controls that preserve that traceability end to end.
From our research library:
- Over 70% of organisations lack automated access risk analysis, user access reviews and provisioning and deprovisioning, according to Pathlock's 2025 Digital Transformation and Access Risk Report.
- Read next: Identity Security Posture Management (ISPM) Guide
What this signals
Configuration drift: the most important question is no longer whether IaC is adopted, but whether live infrastructure can still be proven to match approved code after each change. That shifts governance from periodic review to continuous reconciliation, and it makes state visibility a core security requirement rather than an operational convenience.
As IaC platforms multiply, the control problem moves from single-tool configuration to estate-wide assurance. Security teams should expect policy enforcement, secrets governance, and drift monitoring to converge into one operating model, with identity controls governing the non-human access paths that make deployment possible.
For practitioners
- Implement policy-as-code at merge time Embed policy checks in pull requests and CI pipelines so insecure or non-compliant infrastructure changes are blocked before they reach deployment.
- Protect state files and backend access Restrict access to remote state, encrypt state at rest, and monitor changes to prevent unauthorized edits from bypassing the reviewed code path.
- Continuously detect and reconcile drift Compare live infrastructure against approved definitions on a recurring basis and trigger remediation when runtime state no longer matches source control.
Key takeaways
- Infrastructure as code now functions as a governance layer, so the security question is whether the declared infrastructure and the live environment remain aligned.
- Drift, secrets handling, and policy enforcement are the controls that determine whether IaC is auditable or merely automated.
- The practical goal is code-to-runtime assurance, not just faster provisioning, because unmanaged drift and weak pipeline access create governance blind spots.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while NIST CSF 2.0, CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | PR.AA-05 — Access Permissions, Entitlements and Authorizations | IaC governance depends on controlling who and what can change infrastructure definitions and state. |
| Recommendation — Apply PR.AA-05 to restrict who can modify IaC code, state, and deployment permissions. | ||
| CIS Controls v8 | CIS-5 — Account Management | IaC pipelines and orchestration platforms rely on managed identities and controlled access paths. |
| Recommendation — Use CIS-5 to govern accounts and service identities that operate deployment and orchestration workflows. | ||
| NIST SP 800-53 Rev 5 | AC-6 — Least Privilege | The article centers on limiting access to IaC tooling, state, and deployment actions. |
| IA-5 — Authenticator Management | Secrets handling and short-lived credentials are central to secure IaC operations. | |
| Recommendation — Enforce AC-6 so only narrowly scoped users and automation can alter infrastructure code or runtime state. Apply IA-5 to rotate and manage the authenticators used by IaC pipelines and state access. | ||
| MITRE ATT&CK | TA0006;TA0008 — Credential Access; Lateral Movement | Compromised deployment credentials can expose adjacent infrastructure and expand access across environments. |
| Recommendation — Map IaC credential abuse to TA0006 and TA0008 when assessing pipeline and orchestration risk. | ||
Key terms
- Infrastructure as Code coverage: The share of infrastructure that is created, changed, and governed through code rather than manual console actions. In practice, it measures how much of the environment can be reviewed, reproduced, and remediated through a controlled delivery path instead of ad hoc operator behaviour.
- Policy as Code: Policy as code stores authorization logic in version control and evaluates it through testable, reviewable rules. For agent governance, it makes runtime decisions reproducible and measurable, which is critical when actions can be triggered by untrusted content and executed at machine speed.
- Configuration Drift: Configuration drift is the gradual divergence between a system's intended secure state and the settings it actually runs with over time. In SaaS, drift often appears when admins change sharing, logging, or access controls under pressure and never return to validate the result.
- Remote State: Remote state is the stored record Terraform uses to track managed infrastructure and coordinate future changes. Because it often contains sensitive metadata and becomes a coordination point for multiple users or pipelines, it must be protected like a privileged operational asset.
Deepen your knowledge
NHI Mgmt Group covers identity security, NHI governance, and agentic AI through independent research, practitioner guides, and the NHI Foundation Level course, the industry's only accredited NHI security programme. It is designed for practitioners who need to govern the credentials, privileges, and lifecycle controls behind modern security operations.
Published by the NHIMG editorial team on August 19, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org