Azure Spring Cloud Autoscaling

Hi,
I try to apply the auto-scaling for the apps in our Azure spring cloud and receive the error:

Error: creating Monitor Autoscale Setting: (Name “xxxxxx-geo-weather-auto-scale” / Resource Group “xxxxxx-dev”): insights.AutoscaleSettingsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 – Original Error: autorest/azure: Service returned an error. Status=400 Code=“ResourceNotSupported” Message=“The target resource id ‘/subscriptions/xxxxx/resourceGroups/xxxxxx-dev/providers/Microsoft.AppPlatform/Spring/asc-infotainment-dev/apps/xxxxxx-geo-weather’ is not supported.”

The manual way with the Azure Portal works.

Here my code:

resource “azurerm_monitor_autoscale_setting” “autoscale” {
name = “${var.app_name}-auto-scale”
resource_group_name = var.resource_group_name
location = data.azurerm_spring_cloud_service.spring_cloud.location
target_resource_id = azurerm_spring_cloud_app.app.id

profile {
name = “defaultProfile”

capacity {
  default = 2
  minimum = 2
  maximum = 10
}

rule {
  metric_trigger {
    metric_name        = "Percentage CPU"
    metric_resource_id = azurerm_spring_cloud_app.app.id
    time_grain         = "PT1M"
    statistic          = "Average"
    time_window        = "PT5M"
    time_aggregation   = "Average"
    operator           = "GreaterThan"
    threshold          = 90
    metric_namespace   = "Microsoft.AppPlatform/Spring"
    dimensions {
      name     = "AppName"
      operator = "Equals"
      values   = [azurerm_spring_cloud_app.app.name]
    }
  }

  scale_action {
    direction = "Increase"
    type      = "ChangeCount"
    value     = "1"
    cooldown  = "PT1M"
  }
}

rule {
  metric_trigger {
    metric_name        = "Percentage CPU"
    metric_resource_id = azurerm_spring_cloud_app.app.id
    time_grain         = "PT1M"
    statistic          = "Average"
    time_window        = "PT5M"
    time_aggregation   = "Average"
    operator           = "LessThan"
    threshold          = 25
  }

  scale_action {
    direction = "Decrease"
    type      = "ChangeCount"
    value     = "1"
    cooldown  = "PT1M"
  }
}

}
}

I am not sure, if there is anything missing, basically I took the example code from the terraform registry.

Thanks in advance

Hi seppmaier99
Is it work for you now?
One way to check this is within in spring apps-> your concrete app-> scale out view the resource in json formart.
I checked the target resource id should with some thing in the end with /deployments/.

in addtion, you would need some diemensioname like below
{
“DimensionName”: “Deployment”,
“Operator”: “Equals”,
“Values”: [
“production”
]
}