Why infrastructure as code
Infrastructure as code (IaC) means defining infrastructure, such as networks, virtual machines, storage and permissions, in text files instead of clicking through a console or running ad hoc commands.
Benefits
- Repeatable: the same files create the same environment in development, test and production.
- Reviewable: changes go through pull requests, so others can check them.
- Versioned: the history shows what changed, when and why, and you can roll back.
- Documented: the code describes the system, so the knowledge is not held by one person alone.
- Auditable: it is easier to show what exists and who approved it.
Common pitfalls
- Manual console changes that the code does not know about, which cause drift
- Secrets committed to the repository
- Large, unreviewed changes that are hard to undo
Where to start
Pick one small, low-risk environment, such as a test network with a single virtual machine, and manage all of it through code. Expand once the team trusts the workflow.