From 004b89ae15104aaf2545c6712c733a9f41de2e0d Mon Sep 17 00:00:00 2001 From: hezijie Date: Mon, 10 Apr 2023 11:24:10 +0800 Subject: [PATCH] Add validation block to enforce users to change `sku_tier` from `Paid` to `Standard`. --- README.md | 6 +++--- examples/multiple_node_pools/main.tf | 2 +- examples/multiple_node_pools/providers.tf | 2 +- examples/named_cluster/providers.tf | 2 +- examples/startup/main.tf | 2 +- examples/startup/providers.tf | 2 +- examples/with_acr/main.tf | 2 +- examples/with_acr/providers.tf | 2 +- examples/without_monitor/providers.tf | 2 +- variables.tf | 6 +++++- versions.tf | 2 +- 11 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index be110ffc..7fbf29fc 100644 --- a/README.md +++ b/README.md @@ -242,14 +242,14 @@ The following sections are generated by [terraform-docs](https://github.com/terr | Name | Version | |---------------------------------------------------------------------------|------------------| | [terraform](#requirement\_terraform) | >= 1.3 | -| [azurerm](#requirement\_azurerm) | >= 3.47.0, < 4.0 | +| [azurerm](#requirement\_azurerm) | >= 3.51.0, < 4.0 | | [tls](#requirement\_tls) | >= 3.1 | ## Providers | Name | Version | |---------------------------------------------------------------|------------------| -| [azurerm](#provider\_azurerm) | >= 3.47.0, < 4.0 | +| [azurerm](#provider\_azurerm) | >= 3.51.0, < 4.0 | | [tls](#provider\_tls) | >= 3.1 | ## Modules @@ -388,7 +388,7 @@ No modules. | [scale\_down\_mode](#input\_scale\_down\_mode) | (Optional) Specifies the autoscaling behaviour of the Kubernetes Cluster. If not specified, it defaults to `Delete`. Possible values include `Delete` and `Deallocate`. Changing this forces a new resource to be created. | `string` | `"Delete"` | no | | [secret\_rotation\_enabled](#input\_secret\_rotation\_enabled) | Is secret rotation enabled? This variable is only used when `key_vault_secrets_provider_enabled` is `true` and defaults to `false` | `bool` | `false` | no | | [secret\_rotation\_interval](#input\_secret\_rotation\_interval) | The interval to poll for secret rotation. This attribute is only set when `secret_rotation` is `true` and defaults to `2m` | `string` | `"2m"` | no | -| [sku\_tier](#input\_sku\_tier) | The SKU Tier that should be used for this Kubernetes Cluster. Possible values are `Free` and `Paid` | `string` | `"Free"` | no | +| [sku\_tier](#input\_sku\_tier) | The SKU Tier that should be used for this Kubernetes Cluster. Possible values are `Free` and `Standard` | `string` | `"Free"` | no | | [storage\_profile\_blob\_driver\_enabled](#input\_storage\_profile\_blob\_driver\_enabled) | (Optional) Is the Blob CSI driver enabled? Defaults to `false` | `bool` | `false` | no | | [storage\_profile\_disk\_driver\_enabled](#input\_storage\_profile\_disk\_driver\_enabled) | (Optional) Is the Disk CSI driver enabled? Defaults to `true` | `bool` | `true` | no | | [storage\_profile\_disk\_driver\_version](#input\_storage\_profile\_disk\_driver\_version) | (Optional) Disk CSI Driver version to be used. Possible values are `v1` and `v2`. Defaults to `v1`. | `string` | `"v1"` | no | diff --git a/examples/multiple_node_pools/main.tf b/examples/multiple_node_pools/main.tf index 7de69328..0f9f101f 100644 --- a/examples/multiple_node_pools/main.tf +++ b/examples/multiple_node_pools/main.tf @@ -48,7 +48,7 @@ module "aks" { prefix = "prefix-${random_id.prefix.hex}" resource_group_name = local.resource_group.name os_disk_size_gb = 60 - sku_tier = "Paid" + sku_tier = "Standard" rbac_aad = false vnet_subnet_id = azurerm_subnet.test.id node_pools = local.nodes diff --git a/examples/multiple_node_pools/providers.tf b/examples/multiple_node_pools/providers.tf index 0b7653b8..f52c605f 100644 --- a/examples/multiple_node_pools/providers.tf +++ b/examples/multiple_node_pools/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">= 3.40, < 4.0" + version = ">= 3.51, < 4.0" } random = { source = "hashicorp/random" diff --git a/examples/named_cluster/providers.tf b/examples/named_cluster/providers.tf index 4cdfbde6..c8028a39 100644 --- a/examples/named_cluster/providers.tf +++ b/examples/named_cluster/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">=3.40.0, < 4.0" + version = ">=3.51.0, < 4.0" } curl = { source = "anschoewe/curl" diff --git a/examples/startup/main.tf b/examples/startup/main.tf index e46809fa..5c412e49 100644 --- a/examples/startup/main.tf +++ b/examples/startup/main.tf @@ -92,7 +92,7 @@ module "aks" { rbac_aad = true rbac_aad_managed = true role_based_access_control_enabled = true - sku_tier = "Paid" + sku_tier = "Standard" vnet_subnet_id = azurerm_subnet.test.id agents_labels = { diff --git a/examples/startup/providers.tf b/examples/startup/providers.tf index 2a864aa7..40234623 100644 --- a/examples/startup/providers.tf +++ b/examples/startup/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">= 3.40, < 4.0" + version = ">= 3.51, < 4.0" } curl = { source = "anschoewe/curl" diff --git a/examples/with_acr/main.tf b/examples/with_acr/main.tf index 7f64b0f2..b3a4aece 100644 --- a/examples/with_acr/main.tf +++ b/examples/with_acr/main.tf @@ -63,7 +63,7 @@ module "aks" { network_plugin = "azure" network_policy = "azure" os_disk_size_gb = 60 - sku_tier = "Paid" + sku_tier = "Standard" rbac_aad = false vnet_subnet_id = azurerm_subnet.test.id } \ No newline at end of file diff --git a/examples/with_acr/providers.tf b/examples/with_acr/providers.tf index 0b7653b8..f52c605f 100644 --- a/examples/with_acr/providers.tf +++ b/examples/with_acr/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">= 3.40, < 4.0" + version = ">= 3.51, < 4.0" } random = { source = "hashicorp/random" diff --git a/examples/without_monitor/providers.tf b/examples/without_monitor/providers.tf index 2a864aa7..40234623 100644 --- a/examples/without_monitor/providers.tf +++ b/examples/without_monitor/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">= 3.40, < 4.0" + version = ">= 3.51, < 4.0" } curl = { source = "anschoewe/curl" diff --git a/variables.tf b/variables.tf index b44e9fae..0600f5b6 100644 --- a/variables.tf +++ b/variables.tf @@ -1042,8 +1042,12 @@ variable "secret_rotation_interval" { variable "sku_tier" { type = string - description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are `Free` and `Paid`" + description = "The SKU Tier that should be used for this Kubernetes Cluster. Possible values are `Free` and `Standard`" default = "Free" + validation { + condition = contains(["Free", "Standard"], var.sku_tier) + error_message = "The SKU Tier must be either `Free` or `Standard`. `Paid` is no longer supported since AzureRM provider v3.51.0." + } } variable "storage_profile_blob_driver_enabled" { diff --git a/versions.tf b/versions.tf index ed6f0e31..a0e99ff0 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = ">= 3.47.0, < 4.0" + version = ">= 3.51.0, < 4.0" } tls = { source = "hashicorp/tls"