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

azurerm_kubernetes_cluster - add support for current_kubernetes_version #25079

Merged
merged 2 commits into from
Feb 29, 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 @@ -338,13 +338,15 @@ func TestAccKubernetesCluster_upgrade(t *testing.T) {
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("kubernetes_version").HasValue(olderKubernetesVersion),
check.That(data.ResourceName).Key("current_kubernetes_version").Exists(),
),
},
{
Config: r.upgradeConfig(data, currentKubernetesVersion),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("kubernetes_version").HasValue(currentKubernetesVersion),
check.That(data.ResourceName).Key("current_kubernetes_version").Exists(),
),
},
})
Expand Down
6 changes: 6 additions & 0 deletions internal/services/containers/kubernetes_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,11 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
ForceNew: true,
},

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

"node_resource_group_id": {
Type: pluginsdk.TypeString,
Computed: true,
Expand Down Expand Up @@ -2605,6 +2610,7 @@ func resourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{})
d.Set("portal_fqdn", props.AzurePortalFQDN)
d.Set("disk_encryption_set_id", props.DiskEncryptionSetID)
d.Set("kubernetes_version", props.KubernetesVersion)
d.Set("current_kubernetes_version", props.CurrentKubernetesVersion)
d.Set("enable_pod_security_policy", props.EnablePodSecurityPolicy)
d.Set("local_account_disabled", props.DisableLocalAccounts)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
type KubernetesClusterResource struct{}

var (
olderKubernetesVersion = "1.25.11"
currentKubernetesVersion = "1.26.6"
olderKubernetesVersionAlias = "1.25"
currentKubernetesVersionAlias = "1.26"
olderKubernetesVersion = "1.28.5"
currentKubernetesVersion = "1.29.0"
olderKubernetesVersionAlias = "1.28"
currentKubernetesVersionAlias = "1.29"
)

func TestAccKubernetesCluster_hostEncryption(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,8 @@ In addition to the Arguments listed above - the following Attributes are exporte

* `id` - The Kubernetes Managed Cluster ID.

* `current_kubernetes_version` - The current version running on the Azure Kubernetes Managed Cluster.

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

* `private_fqdn` - The FQDN for the Kubernetes Cluster when private link has been enabled, which is only resolvable inside the Virtual Network used by the Kubernetes Cluster.
Expand Down
Loading