Infrastructure as Code

Infrastructure as code is a programatic way to manage networks, servers, load balancing, virtual systems, etc. It relies on versioning just like the applications that run on top. This is a cornerstone practice for successful DevOps practices. If the infrastructure cannot be automated and coded, the process will always take longer than necessary.

One major issue with infrastructure is environment drift, especially within single pipelines. Having code to wrap around the application deployment to ensure the infrastructure layer is always identical will prevent the common dev vs ops arguments. The key is to prevent inconsistency during deployments.

Best practices around IaC will give development teams the ability to test 'production' scenarios even in the dev environments. Idempotence is a common principle for IaC which states that the environment will always end up in the same state no matter how it started off. Tools such as Terraform and Ansible rely on the concept of Idempotence. There is no 'scripting', there is only state configuration. Teams declare the 'state' the environment should be in, and the tools run commands to bring the environment to that level.