Configuration as Code CaC and Infrastructure as Code IaC
Explains how Infrastructure as Code and Configuration as Code complement each other in a GitOps workflow, covering definitions, differences, tools, and deployment patterns using Git.
This lesson explains how Infrastructure-as-Code (IaC) and Configuration-as-Code (CaC) relate and how they cooperate in a GitOps workflow. We’ll cover definitions, differences, recommended tools, and a practical GitOps pattern for deploying infrastructure and application configurations from Git.
GitOps treats Git as the single source of truth: make changes by updating Git and let automation (CI/CD or a GitOps controller) reconcile those changes against your environments.
IaC provisions and maintains infrastructure resources (cloud services, clusters, networks).
CaC configures operating systems, runtime services, and application settings on that infrastructure.
In GitOps you typically use IaC to create the platform (clusters, VPCs, storage) and CaC to deploy and configure applications inside that platform (Kubernetes manifests, Helm charts, or configuration management scripts).
Use Terraform to create an AWS EKS cluster, VPC, subnets, and IAM roles.
Deploy and configure applications with CaC:
Commit Helm charts or Kubernetes manifests to a gitops-apps repo.
The GitOps controller (Argo CD / Flux) watches gitops-apps and applies manifests to the EKS cluster.
Manage non-Kubernetes hosts:
Use Ansible to provision OS settings, install monitoring agents, and configure bastion hosts; store playbooks in Git and run via CI/CD.
This separation allows platform teams to own and version IaC while application teams manage CaC for their services, with Git enabling auditability and safe rollbacks.
IaC is building the house: foundation, framing, wiring.
CaC is furnishing and operating the house: appliances, thermostat settings, installed software.
By keeping both infrastructure and configuration declarative in Git and automating their application, GitOps delivers reproducibility, observability, and safer rollbacks across both IaC and CaC changes.