hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

No compatibility for `azurerm_kubernetes_cluster` & `azurerm_kubernetes_cluster_node_pool` between `v3` & `v4` versions #27209

Open stevehipwell opened 3 months ago

stevehipwell commented 3 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.9.5

AzureRM Provider Version

3.116.0

Affected Resource(s)/Data Source(s)

azurerm_kubernetes_cluster, azurerm_kubernetes_cluster_node_pool

Terraform Configuration Files

resource "azurerm_kubernetes_cluster" "default" {
  name = "test"

  automatic_channel_upgrade = "patch"
  node_os_channel_upgrade   = "NodeImage"

  default_node_pool {
    enable_auto_scaling    = true
    enable_host_encryption = true
    enable_node_public_ip  = false
  }
}

resource "azurerm_kubernetes_cluster_node_pool" "default" {
  name = "test"

  enable_auto_scaling    = true
  enable_host_encryption = true
  enable_node_public_ip  = false
}

Debug Output/Panic Output

n/a

Expected Behaviour

I'd expect there to be a v3 release with the renamed inputs for v4 and the deprecated inputs documented as such, this would allow portability between major versions where the functionality is identical.

This is what was done for the azurerm_storage_account resource.

Actual Behaviour

There is no version of v3 with compatibility for thev4inputs forazurerm_kubernetes_cluster&azurerm_kubernetes_cluster_node_pool` even where the functionality is identical.

Steps to Reproduce

  1. Attempt to use v3 configuration for azurerm_kubernetes_cluster_node_pool (see above) with v4

Important Factoids

No response

References

No response

ms-henglu commented 2 months ago

Hi @stevehipwell ,

Thank you for taking time to report this issue.

The enable_auto_scaling, enable_host_encryption and enable_node_public_ip have been renamed in the v4.0, please check this doc for more details:

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#azurerm_kubernetes_cluster https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#azurerm_kubernetes_cluster_node_pool

stevehipwell commented 2 months ago

@ms-henglu I understand the changes. What I don't understand is why the new names weren't added in v3 with the old names deprecated so code that should be compatible with both v3 & v4 can use either version.

pszypowicz commented 2 months ago

But this is what "major" release mean according to semver - breaking change. You are supposed to review and adjust parameters when upgrading major release.

https://semver.org/spec/v2.0.0.html

stevehipwell commented 2 months ago

But this is what "major" release mean according to semver - breaking change. You are supposed to review and adjust parameters when upgrading major release.

https://semver.org/spec/v2.0.0.html

@pszypowicz that is correct, but SemVer major breaking changes should be limited to what's required. I'm not complaining about the API changes on these resources required by the new rule on not using preview APIs. But changing input variable names does not require a hard break, as demonstrated by azurerm_storage_account.

In our case we need to change our code to support v4, but if the renames were available in v3 our code would be compatible with both.

TL;DR - This change is user hostile as there is no technical reason why compatibility between v3 & v4 for AKS should have been broken for anyone not using preview functionality.