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 |
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
Note
The example code in this article is located in the Azure Terraform GitHub repo. See more articles and sample code showing how to use Terraform to manage Azure resources
[!INCLUDE open-source-devops-prereqs-azure-subscription.md]
-
Create a directory in which to test and run the sample Terraform code and make it the current directory.
-
Create a file named
providers.tf
and insert the following code: [!code-terraformmaster] -
Create a file named
main.tf
and insert the following code: [!code-terraformmaster] -
Create a file named
variables.tf
and insert the following code: [!code-terraformmaster]
[!INCLUDE terraform-init.md]
[!INCLUDE terraform-plan.md]
[!INCLUDE terraform-apply-plan.md]
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).
[!INCLUDE terraform-plan-destroy.md]
Troubleshoot common problems when using Terraform on Azure
[!div class="nextstepaction"] Learn more about Azure SQL Managed Instance