top of page
  • Writer's pictureShaked Braimok Yosef

Infrastructure Rewriting: How to Do It Right

Many organizations find themselves compelled to undertake a significant rewrite of their infrastructure code for various reasons, including business considerations, product changes, rectifying poorly written code, aligning with best practices, or as part of the cultural change in Platform Engineering (enabling developers to manage the infrastructures themselves). Here are some key points to consider before embarking on the rewrite.

In the management and cultural aspect:

1. Goals Mapping 🎯

Clearly define the reasons for rewriting the code and its importance for the organization. Will it facilitate easier infrastructure management, leading to faster maintenance? Is the aim to enable self-service for developers who will be managing the infrastructure themselves? Is the existing code riddled with issues? Address these questions and more.

2. Point of Contact (POCs) 👩🏽‍💼👨‍💼

Given the gravity of rewriting infrastructure code, involvement should extend beyond the DevOps/SRE team. Integrate knowledge centers for development personnel and product managers into the process. They can align their goals with yours and track the progress and impact of the rewrite on the affected development teams, contributing to a positive Developer Experience.

3. Transparency & Communication 🤝

Communicate changes, goals (as outlined in the previous section), and, most importantly, the progress transparently to all stakeholders, including development teams and product managers. Increased visibility into progress enhances the impact on infrastructure and, consequently, on the product and Developer Experience.

In the technical aspect:

1. Workspaces & demo environments

Utilize workspaces diligently, particularly for testing major changes before applying them to the main workspace. This ensures that developers and customers remain unaffected during the testing phase.

2. Release Management

For effective management of Terraform modules, consider organizing them in folders rather than just relying on a registry. This facilitates careful deployments targeting specific environments, well-documented changes, and quick rollbacks when necessary.

3. Code Enforcement

Ensure strict adherence to conventions and critical points in the code. During a rewrite, numerous changes may occur, potentially disrupting essential elements, ranging from naming conventions to security. If your repositories lack defined tools, it’s advisable to establish them before commencing the rewrite. A well-organized file with a concise guide outlining your standards can also serve this purpose, albeit less swiftly and accurately.

4. CI/CD — For Your Infrastructure Code

Similar to software code, creating a pull request should not only prompt a team member’s review but also tests. These tests should begin with a linter and extend to unit tests, integration tests, E2E, and, of course, the deployment of the apps. Developers’ testing pipelines should run after every infrastructure change you deploy. — If testing for infrastructure code is interesting for you 😊 feel free to comment here and I’ll write some about the process and the tools I recommend.

Equally important is a deployment tool that facilitates collaborative work, documents the applied code, and enhances convenience, ease, and safety. I highly recommend this amazing tool: Env0 🚀

Feel free to contact me at for any questions you may have. Best of luck and enjoy your rewrite! 😉


bottom of page