infrastructure as code
Infrastructure as Code is the practice of defining and managing infrastructure—networks, VMs, containers, databases, etc.—using machine-readable configuration files instead of manual setup or ad-hoc scripts.
IaC definitions live in version control and pass through code reviews and CI/CD pipelines like application code. This makes infrastructure repeatable, testable, and auditable.
Drift occurs when actual infrastructure differs from what’s defined in your IaC code. It happens due to manual changes (e.g., through cloud consoles), one-off scripts, or failed runs leaving intermediate states.
Drift leads to inconsistent behavior, harder debugging, and potential security risks because your code and live environment no longer match.
Most declarative IaC tools maintain a state file that records what the infrastructure currently looks like. The system compares the desired state (code) vs the current state (tracked) to apply only necessary changes.