DevOps for Multi-Tenant DBs using Terraform, Flyway, and Azure SQL
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:
- GitHub: The code for this exercise is hosted here: jslamartina/azure-mt-demo.
- 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!
- 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.
- The examples will be shown from Ubuntu Linux; however, documentation is provided should you wish to use another OS.
- We will be using Flyway CLI as this is focused on DevOps, however any version of Flyway can be used.
- Install Azure CLI: How to install the Azure CLI | Microsoft Learn
- 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:
- Create a Multi-Tenant Database Solution with minimal management and cost overhead by utilizing Terraform…