Infrastructure as Code Security: Drift, State Files and Policy as Code
Infrastructure as code means your servers, networks and firewall rules are defined in text files that live in version control, and a tool builds the real thing from those files. That single change — infrastructure described in reviewable, diffable text — is what makes cloud environments auditable at all. It also introduces failure modes that do not exist when someone clicks through a console. Declarative vs Imperative This distinction shows up on Cloud+ and Security+ alike. Declarative code describes the end state: "there should be three web servers in this subnet with this security group." The tool compares that to reality and makes whatever changes close the gap. Terraform and CloudFormation work this way. Imperative code describes the steps: install this package, edit this file, restart this service. Shell scripts are imperative; Ansible playbooks sit closer to declarative but can do either. Declarative is generally preferred for infrastructure because it is i...