Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hdinsight_kafka_cluster_resource: deprecate kafka_management_node in 4.0 #19423

Merged
merged 2 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions internal/services/hdinsight/hdinsight_kafka_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/hdinsight/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
Expand Down Expand Up @@ -52,7 +53,7 @@ var hdInsightKafkaClusterKafkaManagementNodeDefinition = HDInsightNodeDefinition
}

func resourceHDInsightKafkaCluster() *pluginsdk.Resource {
return &pluginsdk.Resource{
resource := &pluginsdk.Resource{
Create: resourceHDInsightKafkaClusterCreate,
Read: resourceHDInsightKafkaClusterRead,
Update: hdinsightClusterUpdate("Kafka", resourceHDInsightKafkaClusterRead),
Expand Down Expand Up @@ -158,7 +159,12 @@ func resourceHDInsightKafkaCluster() *pluginsdk.Resource {
},
},
},
RequiredWith: []string{"roles.0.kafka_management_node"},
RequiredWith: func() []string {
if !features.FourPointOh() {
return []string{"roles.0.kafka_management_node"}
}
return []string{}
}(),
},

"tags": tags.Schema(),
Expand All @@ -183,6 +189,43 @@ func resourceHDInsightKafkaCluster() *pluginsdk.Resource {
"extension": SchemaHDInsightsExtension(),
},
}

if !features.FourPointOh() {
resource.Schema["roles"] = &pluginsdk.Schema{
Type: pluginsdk.TypeList,
Required: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"head_node": SchemaHDInsightNodeDefinition("roles.0.head_node", hdInsightKafkaClusterHeadNodeDefinition, true),

"worker_node": SchemaHDInsightNodeDefinition("roles.0.worker_node", hdInsightKafkaClusterWorkerNodeDefinition, true),

"zookeeper_node": SchemaHDInsightNodeDefinition("roles.0.zookeeper_node", hdInsightKafkaClusterZookeeperNodeDefinition, true),

"kafka_management_node": SchemaHDInsightNodeDefinition("roles.0.kafka_management_node", hdInsightKafkaClusterKafkaManagementNodeDefinition, false),
},
},
Deprecated: "`kafka_management_node` will be removed in version 4.0 of the AzureRM Provider since it no longer support configurations from the user",
}
} else {
resource.Schema["roles"] = &pluginsdk.Schema{
Type: pluginsdk.TypeList,
Required: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"head_node": SchemaHDInsightNodeDefinition("roles.0.head_node", hdInsightKafkaClusterHeadNodeDefinition, true),

"worker_node": SchemaHDInsightNodeDefinition("roles.0.worker_node", hdInsightKafkaClusterWorkerNodeDefinition, true),

"zookeeper_node": SchemaHDInsightNodeDefinition("roles.0.zookeeper_node", hdInsightKafkaClusterZookeeperNodeDefinition, true),
},
},
}
}

return resource
}

func resourceHDInsightKafkaClusterCreate(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/hdinsight_kafka_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ A `roles` block supports the following:

* `kafka_management_node` - (Optional) A `kafka_management_node` block as defined below.

~> **Note:** This property has been deprecated and will be removed in version 4.0.

---

A `network` block supports the following:
Expand Down