| 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-usage | ai-assisted |
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"]
- Create a random value for the Azure resource group name using random_pet.
- Create an Azure resource group using azurerm_resource_group.
- Create a random value for the Azure Stream Analytics job name using random_pet.
- Create an Azure Stream Analytics job using azurerm_stream_analytics_job.
Note
The sample code for this article is located in the Azure Terraform GitHub repo. You can view the log file containing the test results from current and previous versions of Terraform.
See more articles and sample code showing how to use Terraform to manage Azure resources
-
Create a directory in which to test and run the sample Terraform code and make it the current directory.
-
Create a file named
providers.tfand insert the following code:[!code-terraformmaster]
-
Create a file named
main.tfand insert the following code:[!code-terraformmaster]
-
Create a file named
variables.tfand insert the following code:[!code-terraformmaster]
-
Create a file named
outputs.tfand insert the following code:[!code-terraformmaster]
[!INCLUDE terraform-init.md]
[!INCLUDE terraform-plan.md]
[!INCLUDE terraform-apply-plan.md]
-
Get the Azure resource group name.
resource_group_name=$(terraform output -raw resource_group_name) -
Get the new Azure Stream Analytics job name.
stream_analytics_job_name=$(terraform output -raw stream_analytics_job_name) -
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
-
Get the Azure resource group name.
$resource_group_name=$(terraform output -raw resource_group_name) -
Get the new Azure Stream Analytics job name.
$stream_analytics_job_name=$(terraform output -raw stream_analytics_job_name) -
Run Get-AzStreamAnalyticsJob to display information about the job.
Get-AzStreamAnalyticsJob ` -ResourceGroupName $resource_group_name ` -Name $stream_analytics_job_name
[!INCLUDE terraform-plan-destroy.md]
Troubleshoot common problems when using Terraform on Azure
[!div class="nextstepaction"] Create a dedicated Azure Stream Analytics cluster using Azure portal