terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

azurerm_stream_analytics_cluster V2 pricing plan incorrect streaming_capacity

Open sergeibelov113 opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.9.7

AzureRM Provider Version

4.4.0

Affected Resource(s)/Data Source(s)

azurerm_stream_analytics_cluster

Terraform Configuration Files

Thereis no possibility to set StandardV2 pricing plan via Terraform
(however it is possible to do in azurerm_stream_analytics_job)

Debug Output/Panic Output

see logs below

Expected Behaviour

streaming_capacity = 120

Actual Behaviour

streaming_capacity = 36

Steps to Reproduce

Create stream analytics cluster with basic configuration:

resource "azurerm_resource_group" "example" {
  name     = "34f8b976-a1d7-4dc8-af0c-9eb102c83ada"
  location = "West Europe"
}

resource "azurerm_stream_analytics_cluster" "example" {
  name                = "examplestreamanalyticscluster"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  streaming_capacity  = 36
}

then change the cluster pricing model directly via azure portal to V2 and run terraform plan:

 terraform plan
azurerm_resource_group.example: Refreshing state... [id=/subscriptions/XXXXXXXXXXXXXXXXX/resourceGroups/34f8b976-a1d7-4dc8-af0c-9eb102c83ada]
azurerm_stream_analytics_cluster.example: Refreshing state... [id=/subscriptions/XXXXXXXXXXXXXXXXX/resourceGroups/34f8b976-a1d7-4dc8-af0c-9eb102c83ada/providers/Microsoft.StreamAnalytics/clusters/examplestreamanalyticscluster]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # azurerm_stream_analytics_cluster.example will be updated in-place
  ~ resource "azurerm_stream_analytics_cluster" "example" {
        id                  = "/subscriptions/XXXXXXXXXXXXXXXXX/resourceGroups/34f8b976-a1d7-4dc8-af0c-9eb102c83ada/providers/Microsoft.StreamAnalytics/clusters/examplestreamanalyticscluster"
        name                = "examplestreamanalyticscluster"
      ~ streaming_capacity  = 120 -> 36
        tags                = {}
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Terraform has detected that the streaming_capacity has changed outside of the terraform from 36 to 120 and plans to revert it. Just to be curios If terraform can revert the pricing model back to V2 I ran terraform apply then I got following error (which is also obvious):

│ Error: updating Cluster (Subscription: "XXXXXXXXXXXXXXXXXXXXx"
│ Resource Group Name: "34f8b976-a1d7-4dc8-af0c-9eb102c83ada"
│ Cluster Name: "examplestreamanalyticscluster"): performing Update: unexpected status 400 (400 Bad Request) with response: {
│   "code": "BadRequest",
│   "message": "The JSON provided in the request body is invalid. Property 'capacity' value '36' is not in the acceptable range from '120' to '1320'.",
│   "details": {
│     "code": "400",
│     "message": "The JSON provided in the request body is invalid. Property 'capacity' value '36' is not in the acceptable range from '120' to '1320'.",
│     "correlationId": "69c0bf83-203d-1da8-dc38-c99f8541cf1e",
│     "requestId": "437cd8c2-27db-4923-b9e0-12849e287a25"
│   }
│ }
│
│   with azurerm_stream_analytics_cluster.example,
│   on ok.tf line 34, in resource "azurerm_stream_analytics_cluster" "example":
│   34: resource "azurerm_stream_analytics_cluster" "example" {
│
│ updating Cluster (Subscription: "XXXXXXXXXXXXXXXXXXXXXX"
│ Resource Group Name: "34f8b976-a1d7-4dc8-af0c-9eb102c83ada"
│ Cluster Name: "examplestreamanalyticscluster"): performing Update: unexpected status 400 (400 Bad Request) with response: {
│   "code": "BadRequest",
│   "message": "The JSON provided in the request body is invalid. Property 'capacity' value '36' is not in the acceptable range from '120' to '1320'.",
│   "details": {
│     "code": "400",
│     "message": "The JSON provided in the request body is invalid. Property 'capacity' value '36' is not in the acceptable range from '120' to '1320'.",
│     "correlationId": "69c0bf83-203d-1da8-dc38-c99f8541cf1e",
│     "requestId": "437cd8c2-27db-4923-b9e0-12849e287a25"
│   }
│ }

Which is obvious since the cluster is now switched to V2 pricing model.

But when I set streaming_capacity = 120 in the configuration according to V2 Pricing model and ran terraform plan then i get another error:

 terraform plan
╷
│ Error: expected streaming_capacity to be divisible by 36, got: 120
│
│   with azurerm_stream_analytics_cluster.example,
│   on ok.tf line 38, in resource "azurerm_stream_analytics_cluster" "example":
│   38:   streaming_capacity  = 120

Please support to set streaming_capacity to new values according to V2 pricing plan.

Important Factoids

No response

References

No response

sergeibelov113 avatar Oct 07 '24 19:10 sergeibelov113

Hi @sergeibelov113 , thanks for opening the issue. Currently the API behind this TF resource does not support V2 pricing. Once the service provider team upgrade their API version we will support this feature accordingly.

jiaweitao001 avatar Oct 08 '24 07:10 jiaweitao001

Doesn't that mean that the property

sku_name                                 = "StandardV2"

should say

sku_name                                 = "Standard"

in the documentation on https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/stream_analytics_job ?

oskaremil avatar Jan 16 '25 07:01 oskaremil

This appears to be fixed in the latest version of the preview API. Could we get this resolved? { "id": "/subscriptions/...", "name": "...", "type": "Microsoft.StreamAnalytics/clusters", "location": "...", "tags": {}, "properties": { "createdDate": "2025-09-12T19:28:58.197Z", "clusterId": "...", "provisioningState": "Succeeded", "capacityAllocated": 120, "capacityAssigned": 120 }, "sku": { "name": "DefaultV2", "capacity": 120 }, "apiVersion": "2020-03-01-preview" }

JeffYoungHRB avatar Oct 01 '25 14:10 JeffYoungHRB

Hi @JeffYoungHRB , currently Terraform cannot support preview version APIs. We will support it once it's available in stable API.

jiaweitao001 avatar Oct 09 '25 09:10 jiaweitao001