DevOps for Multi-Tenant DBs using Terraform, Flyway, and Azure SQL

Joseph LaMartina
18 min readJan 22, 2024

Pre-Requisites

This exercise can be read as an article, however if you wish to follow along hands-on, you will need the following:

  1. GitHub: The code for this exercise is hosted here: jslamartina/azure-mt-demo.
  2. An Azure Subscription with at least Contributor access and available credits (estimated $1/hour that the databases are active). Tip: If you have a Visual Studio Pro Subscription, you receive $50 a month in free credits! Visual Studio Enterprise gets $150! Use them!
  3. A Terraform environment that can talk to your Azure Subscription. I will include some tips on installation & configuration, but it will help if you already know how to use Terraform with Azure. Documentation will be provided.
  4. The examples will be shown from Ubuntu Linux; however, documentation is provided should you wish to use another OS.
  5. We will be using Flyway CLI as this is focused on DevOps, however any version of Flyway can be used.
  6. Install Azure CLI: How to install the Azure CLI | Microsoft Learn
  7. General knowledge of Azure SQL, Terraform, and Flyway will help, but is not required.

Introduction

In this exercise, we will build out the following components:

  1. Create a Multi-Tenant Database Solution with minimal management and cost overhead by utilizing Terraform…

--

--