Provisioning Azure Cosmos DB resources with Terraform

Will Velida
The Startup
Published in
10 min readMar 5, 2020

--

Thanks to Terraform, we can deploy Azure Cosmos DB accounts, databases and collections easily

In a DevOps world, we want to have the ability to make changes to our cloud infrastructure easily and intuitively. This is especially true when deploying our databases, as we need to be able to iterate quickly to accommodate any changes in requirements that our applications need to go through.

Azure Cosmos DB is a globally distributed database service that provides developers with an enormous amount of flexibility when it comes to developing globally distributed applications. Thanks to Infrastructure as Code tools like Terraform, we can deploy Cosmos DB accounts and resources easily with just a few lines of code.

In this article, I’m going to show you how you can use Terraform to spin up Cosmos DB Accounts, Databases and Collections quickly and configure them according to the requirements of your applications.

If you want to follow along with this tutorial or even just spin up what I’ve created, you can check out the full sample on my GitHub here.

What is Terraform?

Terraform is an Infrastructure as Code (IaC) tool created by HashiCorp that allows us to define and provision infrastructure using Hashicorp Configuration Language (HCL).

--

--

Will Velida
The Startup

Lead Software Engineer at Azenix | Ex-MSFT | International Conference Speaker. | GitHub: https://github.com/willvelida