diff --git a/internal/services/hdinsight/hdinsight_interactive_query_cluster_resource.go b/internal/services/hdinsight/hdinsight_interactive_query_cluster_resource.go index f83c6b0ae370..94cdd33730bc 100644 --- a/internal/services/hdinsight/hdinsight_interactive_query_cluster_resource.go +++ b/internal/services/hdinsight/hdinsight_interactive_query_cluster_resource.go @@ -30,11 +30,11 @@ var hdInsightInteractiveQueryClusterHeadNodeDefinition = HDInsightNodeDefinition } var hdInsightInteractiveQueryClusterWorkerNodeDefinition = HDInsightNodeDefinition{ - CanSpecifyInstanceCount: true, - MinInstanceCount: 1, - CanSpecifyDisks: false, - CanAutoScaleByCapacity: true, - CanAutoScaleOnSchedule: true, + CanSpecifyInstanceCount: true, + MinInstanceCount: 1, + CanSpecifyDisks: false, + CanAutoScaleByCapacityDeprecated4PointOh: true, + CanAutoScaleOnSchedule: true, } var hdInsightInteractiveQueryClusterZookeeperNodeDefinition = HDInsightNodeDefinition{ @@ -147,10 +147,9 @@ func resourceHDInsightInteractiveQueryCluster() *pluginsdk.Resource { "zookeeper_node": SchemaHDInsightNodeDefinition("roles.0.zookeeper_node", hdInsightInteractiveQueryClusterZookeeperNodeDefinition, true), }, }, - Deprecated: "HDInsight interactive query clusters can no longer be configured through `autoscale.0.capacity`. Use `autoscale.0.recurrence` instead.", } } else { - hdInsightInteractiveQueryClusterWorkerNodeDefinition.CanAutoScaleByCapacity = false + hdInsightInteractiveQueryClusterWorkerNodeDefinition.CanAutoScaleByCapacityDeprecated4PointOh = false resource.Schema["roles"] = &pluginsdk.Schema{ Type: pluginsdk.TypeList, Required: true, diff --git a/internal/services/hdinsight/schema.go b/internal/services/hdinsight/schema.go index 74bf0795ebe5..5b602c9a58d8 100644 --- a/internal/services/hdinsight/schema.go +++ b/internal/services/hdinsight/schema.go @@ -1021,6 +1021,8 @@ type HDInsightNodeDefinition struct { FixedTargetInstanceCount *int32 CanAutoScaleByCapacity bool CanAutoScaleOnSchedule bool + // todo remove in 4.0 + CanAutoScaleByCapacityDeprecated4PointOh bool } func SchemaHDInsightNodeDefinition(schemaLocation string, definition HDInsightNodeDefinition, required bool) *pluginsdk.Schema { @@ -1117,6 +1119,37 @@ func SchemaHDInsightNodeDefinition(schemaLocation string, definition HDInsightNo } } } + // managing `azurerm_hdinsight_interactive_query_cluster` autoscaling through `capacity` doesn't work so we'll deprecate this portion of the schema for 4.0 + if definition.CanAutoScaleByCapacityDeprecated4PointOh { + autoScales["capacity"] = &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + ConflictsWith: []string{ + fmt.Sprintf("%s.0.autoscale.0.recurrence", schemaLocation), + }, + Deprecated: "HDInsight interactive query clusters can no longer be configured through `autoscale.0.capacity`. Use `autoscale.0.recurrence` instead.", + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "min_instance_count": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: countValidation, + }, + "max_instance_count": { + Type: pluginsdk.TypeInt, + Required: true, + ValidateFunc: countValidation, + }, + }, + }, + } + if definition.CanAutoScaleOnSchedule { + autoScales["capacity"].ConflictsWith = []string{ + fmt.Sprintf("%s.0.autoscale.0.recurrence", schemaLocation), + } + } + } if definition.CanAutoScaleOnSchedule { autoScales["recurrence"] = &pluginsdk.Schema{ Type: pluginsdk.TypeList,