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

Data Source: azurerm_hdinsight_cluster - support for cluster_id property #26228

Merged
merged 2 commits into from
Jun 21, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func dataSourceHDInsightSparkCluster() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Computed: true,
},
"cluster_id": {
Type: pluginsdk.TypeString,
Computed: true,
},
},
}
}
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
),
},
})
Expand All @@ -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(),
),
},
})
Expand All @@ -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(),
),
},
})
Expand All @@ -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(),
),
},
})
Expand All @@ -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(),
),
},
})
Expand All @@ -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(),
),
},
})
Expand Down
10 changes: 10 additions & 0 deletions website/docs/d/hdinsight_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Loading