Save everything as code - configuration, infrastructure and pipelines

foundation-technical loop position

What is it?

Configuration-as-Code is the practice of treating all parts of the system as code. This means, storing configuration along with Source Code in a repository such as git or svn. Storing build configurations, application properties and deployment configurations as code means they are tracked and can be recreated at the click of a button.

Infrastructure-as-Code includes system design, also stored as code. In old world IT, infrastructure required specialised skills and physical hardware and cables to be installed. Systems were precious or were not touched / updated often as the people who created them no longer work for the company. The dawn of cloud computing and cloud native applications has meant it is cheap and easy to spin up virtual infrastructure. By storing the configuration of virtual environments as code, they can be life-cycled and recreated whenever needed.

Why store all things as code?

  1. Traceability - storing your config in git implies controls are in place to track who / why a config has changed. Changes can be applied and reverted and are tracked to a single user who made the change.
  2. Repeatable - moving from one cloud provider to another should be simple in modern application development. Picking a deployment target should be like shopping around for the best price that week. By storing all things as code, infrastructure can be re-created in moments in various providers.
  3. Tested - Infra and code can be rolled out, validated and promoted into production environments with confidence and assurance it will behave as expected. No more patches in production
  4. Phoenix server - No more fear of a servers’ configuration drifting. If a server needs to be patched or randomly dies, it’s OK. Just create it again from the stored configuration.

Further reading

  • Martin Fowler on Infra as Code.
  • Ansible is an infrastructure automation tool created by Red Hat, the huge enterprise open source technology provider.
Improve this practice
View all practices