Skip to content

Latest commit

 

History

History
84 lines (51 loc) · 3.34 KB

get-started-azapi-resource.md

File metadata and controls

84 lines (51 loc) · 3.34 KB
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

Quickstart: Deploy your first Azure resource with the AzAPI Terraform provider

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.

Prerequisites

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

[!INCLUDE configure-terraform.md]

Implement the Terraform code

  1. Create a directory in which to test 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 main-generic.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

  1. In your Azure subscription browse to the rg-qs101 resource group.
  2. A new Lab Services account named qs101LabAccount displays as a member of the resource group.

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 using Terraform in Azure