Terraform in the Data Guardian Toolbox

Infrastructure as Code is defining your infrastructure in terms of configuration files and scripts.

More and more, Database Administrators need to learn the principles and tools of infrastructure as code.

Today I’m highlighting Terraform, and why it belongs in the Data Guardian toolbox!

Video: Terraform in the Data Guardian Toolbox

What is Terraform?

Before I get into how Terraform fits in your Data Guardian toolbox, I should let you know what Terraform is.

Terraform is an open-source tool from Hashicorp, the same creators of Vagrant.

Its purpose is to literally define your infrastructure in the form of a file.

Whether you use Virtual Machines or Cloud providers for your infrastructure.
No matter if you deploy your own database packages or leverage a database-as-a-service.
Terraform can work with it all.

You tell Terraform what resources you need, and it will handle the logic to create, modify or even destroy that environment.

It also handles the networking and security components for the infrastructure.

Example Terraform file that creates a Google CloudSQL PostgreSQL instance

By defining your infrastructure in this way, it is repeatable and predictable.

Why should the Data Guardian learn Terraform?

Many dev teams are deploying application stacks using Terraform, and there is no reason that the data environment is not similarly deployed.

As a Data Guardian, you need to know how the data infrastructure works.

So, to be an effective advocate for your data, you need to know how Terraform works.

Where does Terraform fit in the Data Guardian toolbox?

And, once you get a sense of how it works, you can start to leverage it for some of your projects.

You can use Terraform to allow you to do many things:

  • test new versions of the database
  • create stage or dev environments with better data, or better yet, enable the developers do it themselves!
  • increase or decrease instance resources
  • enable easier horizontal scaling
  • protect against accidental deletion of data environments

All of this is managed by a version control system and without having to log into a web console and click things.

Or having to remember the syntax of the command-line tools to do the same thing.

Watch the video above for a demonstration of how easy this is!

What Terraform is not

I should mention that Terraform is great for ensuring the infrastructure is present.

And that it is in the state that you expect in terms of networking, security, and resources.

But it is not a configuration or orchestration tool.

So once you have your environment provisioned with Terraform, then you will want to use a tool like Ansible to install packages and load data and setup replication.

It is important to use the right tool for the job!

Conclusion

With many dev teams deploying application environments using infrastructure as code, it is important for Data Guardians to know how it works for the data environment.

One of the primary tools for this is Terraform, especially when working in cloud environments and services.

Terraform is a great tool for the Data Guardian to efficiently manage their data infrastructure to enable projects like upgrade testing and capacity planning.

And even to enable self-service development data setups for their developers.

It’s not a catch-all tool for Infrastructure as Code, but it is great at deploying infrastructure.

Is your organization leveraging Terraform for their data environment? Let me know in the comments how you like it!