Skip to content

Latest commit

 

History

History
129 lines (83 loc) · 4.85 KB

File metadata and controls

129 lines (83 loc) · 4.85 KB
title Quickstart: Create an Azure Stream Analytics job using Terraform
description In this article, you create an Azure Stream Analytics job using Terraform.
ms.service azure-stream-analytics
ms.topic quickstart
ms.custom devx-track-terraform
author TomArcherMsft
ms.author tarcher
ms.date 4/22/2023
content_well_notification
AI-contribution
ai-usage ai-assisted

Quickstart: Create an Azure Stream Analytics job using Terraform

This article shows how to create an Azure Stream Analytics job using Terraform. Once the job is created, you validate the deployment.

[!INCLUDE Terraform abstract]

In this article, you learn how to:

[!div class="checklist"]

Prerequisites

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]

  5. Create a file named outputs.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. Get the Azure resource group name.

    resource_group_name=$(terraform output -raw resource_group_name)
  2. Get the new Azure Stream Analytics job name.

    stream_analytics_job_name=$(terraform output -raw stream_analytics_job_name)
  3. Run az stream-analytics job show to display information about the job.

    az stream-analytics job show \
    --resource-group $resource_group_name \
    --job-name $stream_analytics_job_name
    
  1. Get the Azure resource group name.

    $resource_group_name=$(terraform output -raw resource_group_name)
  2. Get the new Azure Stream Analytics job name.

    $stream_analytics_job_name=$(terraform output -raw stream_analytics_job_name)
  3. Run Get-AzStreamAnalyticsJob to display information about the job.

     Get-AzStreamAnalyticsJob `
        -ResourceGroupName $resource_group_name `
        -Name $stream_analytics_job_name
    

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"] Create a dedicated Azure Stream Analytics cluster using Azure portal