Skip to main content

Stage 7: Terraform Scripting

As Terraform projects grow in complexity and scale, developers seek ways to automate and streamline their workflows beyond what native Terraform commands offer. This leads to exploring scripting as a means to orchestrate Terraform operations.

  1. The first path usually involves adopting a simple bash script or Makefile to orchestrate Terraform. This works well, up to a point (we know this because it is how we started using Terraform at Cloud Posse).
  2. These scripts evolved to solve specific problems that made Terraform cumbersome as a tool.
  3. Terraform scripts still run on local machines, reflecting the initial stages of development focus.
New Problems
  1. What happens in practice is every team/company using Terraform ends up building different homegrown scripts, often then combining those with Makefiles, into a hodgepodge of configurations with different levels of validation. The scripts grow in complexity and have to survive generations of developers that come and go.
  2. New patterns emerge, for example, hacks that involve Jinja templates, string concatenation, symlinks, and worse... sed & awk replacements!!!
  3. Terraform is run mostly from local workstations/laptops, with no thought for how it will run in CI/CD.

Realization

With these scripts, they are ready to introduce the rest of the team or company to Terraform.

The Atmos Difference

No More Homegrown Scripts

When you use Atmos, you eliminate the need for rampant scripting that is constantly breaking, never tested, poorly parameterized and seldom validated. Instead of relying on scripts that vary between companies and teams, Atmos provides a purpose-built tool designed for Terraform. It introduces a framework that ensures all your Terraform code and configurations are consistently organized and validated, reducing sprawl and inconsistency across the enterprise.

Standardized Framework & Best Practices

The issue with using scripts is the lack of a framework and standardization, leading to chaotic and inconsistent practices. Unlike many DevOps teams that reinvent the wheel, Atmos provides a validated, thoroughly documented framework, ensuring all your developers are on the same page.

Terraform Runs Natively with CI/CD

Atmos comes with native support for multiple CI/CD platforms, including GitHub Actions, Spacelift, and Atlantis.

This means you no longer need to run your workflows on your laptop, enabling anyone to contribute to infrastructure just like they do with application development.

Stop Generating Terraform Code from Templates

The main reason teams resort to using Jinja templates is due to perceived limitations with Terraform itself. However, these limitations stem from the architecture, design, and use of Terraform. With Atmos, you no longer need to generate your Terraform code. Instead, you can use native Terraform code the way it was meant to be used, building more reusable and easier-to-test Terraform root modules.

Try Atmos!