hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

azurerm_stream_analytics_cluster V2 pricing plan incorrect streaming_capacity #27578

Open sergeibelov113 opened 1 month ago

sergeibelov113 commented 1 month ago

Is there an existing issue for this?

Community Note

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

jiaweitao001 commented 1 month ago

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.