Skip to content

Commit 5e15107

Browse files
Merge pull request #12651 from aristosvo/feature/downgrade-aks-sku
`azurerm_kubernetes_cluster`: Support for downgrade `sku_tier`
2 parents e20a8f5 + 4177162 commit 5e15107

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

azurerm/internal/services/containers/kubernetes_cluster_other_resource_test.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,13 @@ func testAccKubernetesCluster_upgradeSkuTier(t *testing.T) {
344344
),
345345
},
346346
data.ImportStep(),
347+
{
348+
Config: r.freeSkuConfig(data),
349+
Check: acceptance.ComposeTestCheckFunc(
350+
check.That(data.ResourceName).ExistsInAzure(r),
351+
),
352+
},
353+
data.ImportStep(),
347354
})
348355
}
349356

@@ -1156,9 +1163,6 @@ resource "azurerm_kubernetes_cluster" "test" {
11561163
}
11571164

11581165
func (KubernetesClusterResource) paidSkuConfig(data acceptance.TestData) string {
1159-
// @tombuildsstuff (2020-05-29) - this is only supported in a handful of regions
1160-
// whilst in Preview - hard-coding for now
1161-
location := "westus2" // TODO: data.Locations.Primary
11621166
return fmt.Sprintf(`
11631167
provider "azurerm" {
11641168
features {}
@@ -1186,13 +1190,10 @@ resource "azurerm_kubernetes_cluster" "test" {
11861190
type = "SystemAssigned"
11871191
}
11881192
}
1189-
`, data.RandomInteger, location, data.RandomInteger, data.RandomInteger)
1193+
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger)
11901194
}
11911195

11921196
func (KubernetesClusterResource) freeSkuConfig(data acceptance.TestData) string {
1193-
// @tombuildsstuff (2020-05-29) - this is only supported in a handful of regions
1194-
// whilst in Preview - hard-coding for now
1195-
location := "westus2" // TODO: data.Locations.Primary
11961197
return fmt.Sprintf(`
11971198
provider "azurerm" {
11981199
features {}
@@ -1219,7 +1220,7 @@ resource "azurerm_kubernetes_cluster" "test" {
12191220
type = "SystemAssigned"
12201221
}
12211222
}
1222-
`, data.RandomInteger, location, data.RandomInteger, data.RandomInteger)
1223+
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger)
12231224
}
12241225

12251226
func (KubernetesClusterResource) tagsConfig(data acceptance.TestData) string {

azurerm/internal/services/containers/kubernetes_cluster_resource.go

+1-10
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
4141
}),
4242

4343
CustomizeDiff: pluginsdk.CustomDiffInSequence(
44-
// Downgrade from Paid to Free is not supported and requires rebuild to apply
45-
pluginsdk.ForceNewIfChange("sku_tier", func(ctx context.Context, old, new, meta interface{}) bool {
46-
return new == "Free"
47-
}),
4844
// Migration of `identity` to `service_principal` is not allowed, the other way around is
4945
pluginsdk.ForceNewIfChange("service_principal.0.client_id", func(ctx context.Context, old, new, meta interface{}) bool {
5046
return old == "msi" || old == ""
@@ -657,12 +653,7 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
657653
"sku_tier": {
658654
Type: pluginsdk.TypeString,
659655
Optional: true,
660-
// @tombuildsstuff (2020-05-29) - Preview limitations:
661-
// * Currently, there is no way to remove Uptime SLA from an AKS cluster after creation with it enabled.
662-
// * Private clusters aren't currently supported.
663-
// @jackofallops (2020-07-21) - Update:
664-
// * sku_tier can now be upgraded in place, downgrade requires rebuild
665-
Default: string(containerservice.ManagedClusterSKUTierFree),
656+
Default: string(containerservice.ManagedClusterSKUTierFree),
666657
ValidateFunc: validation.StringInSlice([]string{
667658
string(containerservice.ManagedClusterSKUTierFree),
668659
string(containerservice.ManagedClusterSKUTierPaid),

website/docs/r/kubernetes_cluster.html.markdown

-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ resource "azurerm_kubernetes_cluster" "example" {
166166

167167
* `sku_tier` - (Optional) The SKU Tier that should be used for this Kubernetes Cluster. Possible values are `Free` and `Paid` (which includes the Uptime SLA). Defaults to `Free`.
168168

169-
~> **Note:** It is currently possible to upgrade in place from `Free` to `Paid`. However, changing this value from `Paid` to `Free` will force a new resource to be created.
170-
171169
* `tags` - (Optional) A mapping of tags to assign to the resource.
172170

173171
* `windows_profile` - (Optional) A `windows_profile` block as defined below.

0 commit comments

Comments
 (0)