Skip to content

Latest commit

 

History

History
84 lines (50 loc) · 3.33 KB

instance-create-terraform.md

File metadata and controls

84 lines (50 loc) · 3.33 KB
title description author ms.author ms.reviewer ms.date ms.service ms.topic ms.custom
Quickstart: Create managed instance with Terraform
Learn how to create and deploy SQL Managed Instance with Terraform
urosran
urandjelovic
mathoma
12/06/2022
sql-managed-instance
quickstart
devx-track-terraform

Quickstart: Create instance with Terraform - Azure SQL Managed Instance

Article tested with the following Terraform and Terraform provider versions:

This article shows how to deploy an Azure SQL Managed Instance in a virtual network (vNet) and a subnet associated with a route table and a network security group by using Terraform.

[!INCLUDE Terraform abstract]

In this article, you learn how to:

[!div class="checklist"]

  • Create all supporting services for SQL Managed Instance to run on
  • Deploy SQL Managed Instance

Prerequisites

[!INCLUDE open-source-devops-prereqs-azure-subscription.md]

Implement the Terraform code

  1. Create a directory in which to test and run the sample Terraform code and make it the current directory.

  2. Create a file named providers.tf and insert the following code: [!code-terraformmaster]

  3. Create a file named main.tf and insert the following code: [!code-terraformmaster]

  4. Create a file named variables.tf and insert the following code: [!code-terraformmaster]

Initialize Terraform

[!INCLUDE terraform-init.md]

Create a Terraform execution plan

[!INCLUDE terraform-plan.md]

Apply a Terraform execution plan

[!INCLUDE terraform-apply-plan.md]

Verify the results

To verify the results within the Azure portal, browse to the new resource group. The new instance will be in the new resource group after it has been deployed. To see the deployment progress keep your PowerShell open or navigate to the Azure portal, search for SQL Managed Instance and then filter all instances by status).

Clean up resources

[!INCLUDE terraform-plan-destroy.md]

Troubleshoot Terraform on Azure

Troubleshoot common problems when using Terraform on Azure

Next steps

[!div class="nextstepaction"] Learn more about Azure SQL Managed Instance