{"id":754,"date":"2022-06-11T18:12:22","date_gmt":"2022-06-11T08:12:22","guid":{"rendered":"https:\/\/sysmit.com\/cf22\/?p=754"},"modified":"2023-12-13T15:28:02","modified_gmt":"2023-12-13T05:28:02","slug":"sre-safer-infrastructure-as-code-iac","status":"publish","type":"post","link":"https:\/\/sysmit.com\/cf22\/sre-safer-infrastructure-as-code-iac\/","title":{"rendered":"SRE’s role in safer infrastructure-as-code"},"content":{"rendered":"\n

This article explores 2 simple ways for SREs to drive better practices and code hygiene within infrastructure-as-code (IAC) tooling like Terraform.<\/p>\n\n\n\n

Why bother? <\/p>\n\n\n\n

Because of its centrality to cloud infrastructure efficiency, <\/strong>it’s highly likely that you will get involved with an IAC problem at some point in your SRE career. <\/p>\n\n\n\n

I will mention Terraform from time-to-time as an adjunct to IAC. However, many of the issues will likely apply to similar IAC tools like Pulumi, AWS CloudFormation and more. <\/p>\n\n\n\n

Terraform helps automate large parts of platform work and cloud provisioning. However, despite its automation promise, the nature of Terraform work can generate ongoing maintenance toil<\/strong>.<\/p>\n\n\n\n

Let’s explore two optimizations for Terraform to reduce potential toil and risk burden. <\/p>\n\n\n

Keep your Terraform code organized<\/h2>\n\n\n

Yevginy “Jim” Brikman is a consultant at Gruntworks, specializing in Terraform, Hashicorp’s infrastructure provisioning tool. He learned a few interesting things from writing 300,000 lines of Terraform code<\/a>.<\/p>\n\n\n\n

One of these learnings was that many teams keep their Terraform code as a single monolithic file<\/strong>. It’s mind blowing to consider this, but many engineering teams still have elements of legacy culture.<\/p>\n\n\n\n

He noted more than a few teams storing all the environment configurations (development, QA, testing, staging, and production) on one gigantic file. This led to several problems including:<\/p>\n\n\n\n