title | description | keywords | ms.topic | ms.date | ms.custom | author | ms.author |
---|---|---|---|---|---|---|---|
Quickstart - Deploy your first Azure resource with the AzAPI Terraform provider |
Learn how to use the AzAPI Terraform provider to manage an Azure Lab Service |
azure devops terraform lab azapi resource |
quickstart |
04/24/2022 |
devx-track-terraform |
grayzu |
markgray |
Article tested with the following Terraform and Terraform provider versions:
[!INCLUDE Terraform abstract]
In this article, you learn how to use the AzAPI Terraform provider to manage an Azure service that is not currently supported by the AzureRM provider. The azapi_resource
will be used to manage an Azure Lab Services account as well as a lab.
[!div class="checklist"]
- Define and configure the AzureRM and AzAPI providers.
- Use the AzureRM provider to create an Azure resource group
- Use the AzureRM provider to register the "Microsoft.LabServices" provider in your subscription
- Use the AzAPI provider to create the Azure Lab Services resources
Note
The example code in this article is located in the Azure Terraform GitHub repo.
[!INCLUDE open-source-devops-prereqs-azure-subscription.md]
[!INCLUDE configure-terraform.md]
-
Create a directory in which to test 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
main-generic.tf
and insert the following code:[!code-terraformmaster]
[!INCLUDE terraform-init.md]
[!INCLUDE terraform-plan.md]
[!INCLUDE terraform-apply-plan.md]
- In your Azure subscription browse to the
rg-qs101
resource group. - A new Lab Services account named
qs101LabAccount
displays as a member of the resource group.
[!INCLUDE terraform-plan-destroy.md]
Troubleshoot common problems when using Terraform on Azure
[!div class="nextstepaction"] Learn more about using Terraform in Azure