Don't have an account?

Sign up and get a 30 day free trial. No credit card required.

1.1

Why we need Terraform Cloud?

In this episode we will explore the reasons behind using Terraform Cloud. Why we need it and how we'll use it.

Segregation of Responsibility

When it comes to provisioning infrastructure we believe terraform is the right way to do it. Creating VMs setting up networking, provisioning databases we believe these are things that should be done with terraform, but for operational tasks that happen every day at higher frequency we believe those should be done by Opsmaru.

Segregation of responsibility

Another way to think about it is to define what we believe is 'infrastructure' and what is 'application'. From our perspective infrastructure often involves piping things together and creating the underlying resource that runs what we as developers care about the application itself.

Infrastructure

  • Compute Clusters
  • Networking
  • Firewall Rules
  • Load Balancer
  • Databases

Application

  • Provisoning Containers
  • Build / Deploy Cycle
  • Traffic Routing Rules
  • Updating Containers with new Code
  • Provisioning and Renewing SSL

If you break things down this way, you'll see that the Application layer consists of things that need to happen on a regular basis and are things that developers generally will need control over.

Infrastructural components generally need less frequent changes, once you set it up it doesn't change often or at all.

Opsmaru - Github - Terraform Workflow

Now that we understand which systems are responsible for which parts let's take a look at how all the services tie together to create a workflow that allows you to go from generating infrastructure code to actually provisioning the infrastructure.

Infrastructure builder workflow

While Opsmaru does not directly handle provisioning your infrastructure it does provide you with the tools that will generate the infrastructure code out of the box.

Once this code is generated it gets pushed to github and a repository is created. The repository is then connected to terraform cloud as a workspace.

When a change is made on Opsmaru it is propagated to Github repository as a pull request. Once the change is merged the plan runs and the change is applied to the underlying infrastructure.

Credentials Management

Given that for all the infrastructural provisioning happens on terraform cloud. We will need to aggregate all the credentials on terraform cloud.

This is how terraform cloud will have access to the APIs required to do the provisioning.

Credentials management on terraform cloud

It's important to note that Opsmaru never has direct access to your underlying infrastructure. Opsmaru simply generates the code and delegates all the actual provisioning to Terraform.

Terraform will also orchestrate and inform Opsmaru of events (via our terraform provider) regarding the provisioning so we'll need to add Opsmaru credentials to Terraform cloud as well.

Resources

The code generated from Opsmaru utilizes terraform modules that we develop and maintain. You can have a look at them below:

We have more modules in development however they're work in progress and not yet ready for deployment.


Instructor

Zack's profile picture

Zack Siri

Founder

Zack is the creator of Opsmaru. He's worked as CTO in many companies across many industries, everything from hospitality to fin-tech.

He's currently building Opsmaru and loves help customers simplify their DevOps journey. He's happy to share his knowledge and experience to empower customers to get the most out of Opsmaru.