Generated Infrastructure Drift

Understanding the consequences of manual changes on generated infrastructure and drift in programming
Generated infrastructure is configuration that a tool writes from a higher-level description, such as a Dockerfile from a service definition, a routing file from a list of services, or a build config from a project manifest. The generator is the source of truth, and the output is a build artifact.
Drift happens when someone changes the output by hand. The next generation overwrites the change, or the output and the description stop agreeing. Either way, the system behaves differently from what the team thinks it does.
What breaks when the model touches the framebuffer
When working with generated infrastructure, it's essential to understand the relationship between the generator and the output. The generator is the single source of truth, and any manual changes to the output can cause drift.
For example, when using a Dockerfile to generate a container, any manual changes to the container's configuration can be overwritten by the next generation. This can lead to unexpected behavior and errors.
Four rules we use to prevent coordinate drift
To prevent drift, teams can follow four rules:
-
Use version control, such as Git, to track changes to the generator and the output.
-
Implement continuous integration and continuous deployment (CI/CD) pipelines to automate the generation and deployment of infrastructure.
-
Use infrastructure as code tools, such as Terraform or CloudFormation, to manage and version infrastructure configurations.
-
Monitor and audit changes to the output to detect and prevent drift.
| Tool | Description | Use Case |
|---|---|---|
| Dockerfile | Generates a container from a service definition | Containerization |
| Terraform | Manages and versions infrastructure configurations | Infrastructure as code |
| Kubernetes | Orchestrates and deploys containerized applications | Container orchestration |
What is generated infrastructure?
Generated infrastructure is configuration that a tool writes from a higher-level description.
How does drift happen?
Drift happens when someone changes the output by hand, causing the generator and the output to disagree.
What are the consequences of drift?
The consequences of drift can include unexpected behavior, errors, and security vulnerabilities.
How can teams prevent drift?
Teams can prevent drift by following the four rules outlined above and using tools such as version control, CI/CD pipelines, and infrastructure as code.
In conclusion, generated infrastructure and drift are critical concepts in programming and DevOps. By understanding the causes and consequences of drift, teams can take steps to prevent it and ensure the reliability and security of their systems.
Source: tdk-cli



No Comments
Add Your Comment