Skip to content

Lesson 8 of 13 · 3 min read

Infrastructure as Code Scanning and Runtime Drift

Free lessonReviewed By the AISecurityInterviews editorial team
Reading position
In this lesson

TL;DR: Infrastructure as code scanning evaluates intended configuration. Check the resolved deployment plan and the actual cloud state as separate evidence, then bind any approval to the change that will be applied.

Before you read

Pick an answer before you read further. The lesson below explains it, and guessing first, right or wrong, helps the explanation stay with you.

  1. 1A template passes policy checks, but an operator later makes its storage public. Will the old scan detect this?

Three representations, three failure modes

Infrastructure as code (IaC) expresses desired resources and relationships. The source can contain variables, modules and conditions whose final values are not yet known. A resolved plan adds provider and environment context. The deployed cloud state shows what currently exists, including manual edits and resources outside the pipeline.

A source policy may prohibit unrestricted administrative ingress, require storage encryption or constrain role trust. It does not prove that a later deployment used those inputs. A plan can also contain unknown values. The review must distinguish pass, fail, not applicable and unresolved; silently interpreting an unresolved network range as private weakens the gate.

Make policy findings reviewable

Retain the resource address, rule identifier, input revision, plan identity and the relevant evaluated properties. Protect plan artifacts because they can contain sensitive values. A suppression should explain the business need, compensating control, owner and expiry. Scope it to the intended resource rather than ignoring a rule across the organization.

Policies should express the boundary being protected. A rule against public administrative ports addresses remote reachability. Encryption configuration protects a different property and does not make that exposure acceptable. Explain the policy in terms of the asset, the caller and the permitted path so that developers can fix the design rather than merely silence the scanner.

SECURITY OPERATIONS
Compare intention with deployed state

Boundary checks

Unknown values

  • Require resolution or a bounded exception.

Drift signal

  • Assign the resource owner and recheck.
1/4

Source

Templates and modules

A manual console edit can invalidate the old deployment evidence.

A storage example

In a fictional analytics service, a module defaults to private storage, but an environment override adds a public policy. A source check limited to the module defaults can miss the effective exposure. Review the resolved plan, including the policy and the resource's wider access settings. After deployment, confirm the actual state through authorized read-only observation.

Now suppose an emergency change happens through the console. Runtime posture management should detect the drift and link it to the owning configuration. Decide whether to revert the change or update the reviewed source. Blindly applying the old template may break a legitimate emergency mitigation, so preserve the change reason and the incident context.

Tools, checked November 2026

Checkov's documentation covers infrastructure frameworks, policy suppression, hard and soft failure, and variable handling. Snyk IaC documents infrastructure checks through its CLI family. Their existence does not establish identical policy semantics or coverage. Evaluate each against your provider, module patterns and unresolved-value cases.

Bridgecrew's acquisition announcement explains its relationship to Palo Alto Networks and Checkov. Avoid treating an older vendor name as a separate current control without checking the product being purchased.

CI/CD integration with an exit condition

Run checks early for feedback and enforce required decisions at the release boundary. Pin reviewed policy versions and make upgrades visible. A scanner outage should produce a failed required assessment or a documented exception, not an empty success. Keep application deployment permissions separate from policy-reporting permissions.

Finish by reviewing IaC policy design and cloud posture management.

Check yourself

Say or write your answer first, then reveal. Explaining it from memory, in your own words, is the skill an interviewer is checking.

  1. 1Why scan a resolved plan after scanning source?

  2. 2What should a drift repair preserve?

Practise it as an interviewer asks it

Course lessons that teach this

Related lessons