Skip to content

Commit

Permalink
azurerm_hdinsight_interactive_query_cluster - Updating the deprecat…
Browse files Browse the repository at this point in the history
…ion message from #21981 (#22062)
  • Loading branch information
mbfrahry authored Jun 8, 2023
1 parent a57b897 commit 59b750d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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,
Expand Down
33 changes: 33 additions & 0 deletions internal/services/hdinsight/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 59b750d

Please sign in to comment.