Skip to content

Commit

Permalink
add current_kubernetes_version to data source (#22986)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephybun authored Aug 16, 2023
1 parent 1363f31 commit a1c4554
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 12 additions & 5 deletions internal/services/containers/kubernetes_cluster_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"time"

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
Expand Down Expand Up @@ -202,6 +203,11 @@ func dataSourceKubernetesCluster() *pluginsdk.Resource {
Computed: true,
},

"current_kubernetes_version": {
Type: pluginsdk.TypeString,
Computed: true,
},

"dns_prefix": {
Type: pluginsdk.TypeString,
Computed: true,
Expand Down Expand Up @@ -738,11 +744,12 @@ func dataSourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}
d.Set("location", location.Normalize(model.Location))

if props := model.Properties; props != nil {
d.Set("dns_prefix", props.DnsPrefix)
d.Set("fqdn", props.Fqdn)
d.Set("disk_encryption_set_id", props.DiskEncryptionSetID)
d.Set("private_fqdn", props.PrivateFQDN)
d.Set("kubernetes_version", props.KubernetesVersion)
d.Set("dns_prefix", pointer.From(props.DnsPrefix))
d.Set("fqdn", pointer.From(props.Fqdn))
d.Set("disk_encryption_set_id", pointer.From(props.DiskEncryptionSetID))
d.Set("private_fqdn", pointer.From(props.PrivateFQDN))
d.Set("kubernetes_version", pointer.From(props.KubernetesVersion))
d.Set("current_kubernetes_version", pointer.From(props.CurrentKubernetesVersion))

nodeResourceGroup := ""
if v := props.NodeResourceGroup; v != nil {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ The following attributes are exported:

* `agent_pool_profile` - An `agent_pool_profile` block as documented below.

* `current_kubernetes_version` - Contains the current version of Kubernetes running on the Cluster.

* `dns_prefix` - The DNS Prefix of the managed Kubernetes cluster.

* `fqdn` - The FQDN of the Azure Kubernetes Managed Cluster.
Expand Down

0 comments on commit a1c4554

Please sign in to comment.