Showing posts from August, 2023

Introduction to IaC: Deploying Data infrastructure to Azure using Terraform (Part 3 - Azure SQL Database)

In Part 1 , we explain the basics and prerrequisites to work with Terraform. In Part 2 , we created our first Azure resource. On this post we will create an Azure SQL Database and configure it so we can access it right away. Example 2: Deploy and configure an Azure SQL database To create an Azure SQL database, we need at least the following: Resource group (we already have it from the previous example) Azure SQL Server Azure SQL database At least one firewall rule We can obtain code snippets on each resource from the Terraform provider documentation we checked on the previous example: We proceed to add each component on the file (do not delete the previous code we have there) At the end we should have something like this (just check resource names and parameters to match what you want.) terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "3.

Introduction to IaC: Deploying Data infrastructure to Azure using Terraform (Part 2 - our first Azure resource)

Continuing our Part 1 , we already set up our environment, we can now setup our very first example (do not worry if is too simple at this point, but this is just to understand how it works). Example 1: Deploy an Azure Resource Group I think the Azure Resource Group is the most basic Azure resource, so we will verify our setup is ok by deploying one. First, create your project folder on your local machine, in my case I am using C:\Terraform\Terraform_AZ_example but you can use any path you want. Then, open that folder in VSCode: cd C:\Terraform\Terraform_AZ_example code . Or use the GUI to open the folder:   Once opened, I like, as a best practice to add this .gitignore file even when you work locally, so sensitive information and Terraform state is not uploaded if you decide source to GitHub: # Local .terraform directories **/. terraform /* # .tfstate files *. tfstate *. tfstate .* # Crash log files crash . log crash .*. log # Exclude all .tfvars files, which are likely

Introduction to IaC: Deploying Data infrastructure to Azure using Terraform (Part 1 - Intro and prerequisites)

Introduction One integral part of modern Continuous Integration and Continuous Development (CI/CD) pipelines is the ability to create the underlying infrastructure as part of the pipeline in a consistent and repeatable manner. Infrastructure as Code (IaC) offers this capability, allowing us to automate and deploy multi-cloud infrastructure as definition scripts. This approach helps us to reduce time invested in provisioning the infrastructure, as well as reducing human errors or misconfigurations.  The infrastructure can also be redeployed to other environments knowing that the configuration will be the same each time. Although Azure offers ARM templates and AWS offers CloudFormation, these are just for its respective cloud provider. Which option do we have if we need an enterprise-grade solution that supports multi-cloud environments and can integrate with our CI/CD pipelines? Terraform is a declarative, open source IaC tool that can deploy to multiple cloud providers and offers a gr