diff --git a/internal/services/hdinsight/hdinsight_cluster_data_source.go b/internal/services/hdinsight/hdinsight_cluster_data_source.go index ca8d81d8db37..c7bef36cc051 100644 --- a/internal/services/hdinsight/hdinsight_cluster_data_source.go +++ b/internal/services/hdinsight/hdinsight_cluster_data_source.go @@ -110,6 +110,10 @@ func dataSourceHDInsightSparkCluster() *pluginsdk.Resource { Type: pluginsdk.TypeString, Computed: true, }, + "cluster_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, }, } } @@ -151,6 +155,7 @@ func dataSourceHDInsightClusterRead(d *pluginsdk.ResourceData, meta interface{}) d.Set("location", location.Normalize(model.Location)) if props := model.Properties; props != nil { + d.Set("cluster_id", props.ClusterId) d.Set("cluster_version", props.ClusterVersion) d.Set("tier", string(pointer.From(props.Tier))) d.Set("tls_min_version", props.MinSupportedTlsVersion) diff --git a/internal/services/hdinsight/hdinsight_cluster_data_source_test.go b/internal/services/hdinsight/hdinsight_cluster_data_source_test.go index 61f7057014d1..29045e8b30fb 100644 --- a/internal/services/hdinsight/hdinsight_cluster_data_source_test.go +++ b/internal/services/hdinsight/hdinsight_cluster_data_source_test.go @@ -25,6 +25,7 @@ func TestAccDataSourceHDInsightCluster_hadoop(t *testing.T) { check.That(data.ResourceName).Key("edge_ssh_endpoint").HasValue(""), check.That(data.ResourceName).Key("https_endpoint").Exists(), check.That(data.ResourceName).Key("ssh_endpoint").Exists(), + check.That(data.ResourceName).Key("cluster_id").Exists(), ), }, }) @@ -42,6 +43,7 @@ func TestAccDataSourceHDInsightCluster_hbase(t *testing.T) { check.That(data.ResourceName).Key("edge_ssh_endpoint").HasValue(""), check.That(data.ResourceName).Key("https_endpoint").Exists(), check.That(data.ResourceName).Key("ssh_endpoint").Exists(), + check.That(data.ResourceName).Key("cluster_id").Exists(), ), }, }) @@ -59,6 +61,7 @@ func TestAccDataSourceHDInsightCluster_interactiveQuery(t *testing.T) { check.That(data.ResourceName).Key("edge_ssh_endpoint").HasValue(""), check.That(data.ResourceName).Key("https_endpoint").Exists(), check.That(data.ResourceName).Key("ssh_endpoint").Exists(), + check.That(data.ResourceName).Key("cluster_id").Exists(), ), }, }) @@ -76,6 +79,7 @@ func TestAccDataSourceHDInsightCluster_kafka(t *testing.T) { check.That(data.ResourceName).Key("edge_ssh_endpoint").HasValue(""), check.That(data.ResourceName).Key("https_endpoint").Exists(), check.That(data.ResourceName).Key("ssh_endpoint").Exists(), + check.That(data.ResourceName).Key("cluster_id").Exists(), ), }, }) @@ -94,6 +98,7 @@ func TestAccDataSourceHDInsightCluster_kafkaWithRestProxy(t *testing.T) { check.That(data.ResourceName).Key("https_endpoint").Exists(), check.That(data.ResourceName).Key("ssh_endpoint").Exists(), check.That(data.ResourceName).Key("kafka_rest_proxy_endpoint").Exists(), + check.That(data.ResourceName).Key("cluster_id").Exists(), ), }, }) @@ -111,6 +116,7 @@ func TestAccDataSourceHDInsightCluster_spark(t *testing.T) { check.That(data.ResourceName).Key("edge_ssh_endpoint").HasValue(""), check.That(data.ResourceName).Key("https_endpoint").Exists(), check.That(data.ResourceName).Key("ssh_endpoint").Exists(), + check.That(data.ResourceName).Key("cluster_id").Exists(), ), }, }) diff --git a/website/docs/d/hdinsight_cluster.html.markdown b/website/docs/d/hdinsight_cluster.html.markdown index 20ca11e3e4b8..b6752dc34351 100644 --- a/website/docs/d/hdinsight_cluster.html.markdown +++ b/website/docs/d/hdinsight_cluster.html.markdown @@ -22,6 +22,10 @@ data "azurerm_hdinsight_cluster" "example" { output "https_endpoint" { value = data.azurerm_hdinsight_cluster.example.https_endpoint } + +output "cluster_id" { + value = data.azurerm_hdinsight_cluster.example.cluster_id +} ``` ## Argument Reference @@ -32,6 +36,12 @@ output "https_endpoint" { ## Attributes Reference +* `id` - The fully qualified HDInsight resource ID. + +* `name` - The HDInsight Cluster name. + +* `cluster_id` - The HDInsight Cluster ID. + * `location` - The Azure Region in which this HDInsight Cluster exists. * `cluster_version` - The version of HDInsights which is used on this HDInsight Cluster.