Skip to content

Commit c9ea6f8

Browse files
authored
Add support for scale_down_mode (#285)
* add support for `scale_down_mode` Co-authored-by: zjhe <hezijie@microsoft.com>
1 parent cd3597f commit c9ea6f8

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ No modules.
351351
| <a name="input_rbac_aad_tenant_id"></a> [rbac\_aad\_tenant\_id](#input\_rbac\_aad\_tenant\_id) | (Optional) The Tenant ID used for Azure Active Directory Application. If this isn't specified the Tenant ID of the current Subscription is used. | `string` | `null` | no |
352352
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | The resource group name to be imported | `string` | n/a | yes |
353353
| <a name="input_role_based_access_control_enabled"></a> [role\_based\_access\_control\_enabled](#input\_role\_based\_access\_control\_enabled) | Enable Role Based Access Control. | `bool` | `false` | no |
354+
| <a name="input_scale_down_mode"></a> [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 |
354355
| <a name="input_secret_rotation_enabled"></a> [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 |
355356
| <a name="input_secret_rotation_interval"></a> [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 |
356357
| <a name="input_sku_tier"></a> [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 |

main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ resource "azurerm_kubernetes_cluster" "main" {
5656
os_disk_size_gb = var.os_disk_size_gb
5757
os_disk_type = var.os_disk_type
5858
pod_subnet_id = var.pod_subnet_id
59+
scale_down_mode = var.scale_down_mode
5960
tags = merge(var.tags, var.agents_tags)
6061
type = var.agents_type
6162
ultra_ssd_enabled = var.ultra_ssd_enabled
@@ -81,6 +82,7 @@ resource "azurerm_kubernetes_cluster" "main" {
8182
os_disk_size_gb = var.os_disk_size_gb
8283
os_disk_type = var.os_disk_type
8384
pod_subnet_id = var.pod_subnet_id
85+
scale_down_mode = var.scale_down_mode
8486
tags = merge(var.tags, var.agents_tags)
8587
type = var.agents_type
8688
ultra_ssd_enabled = var.ultra_ssd_enabled

variables.tf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ variable "automatic_channel_upgrade" {
9898
default = null
9999
description = "(Optional) The upgrade channel for this Kubernetes Cluster. Possible values are `patch`, `rapid`, `node-image` and `stable`. By default automatic-upgrades are turned off. Note that you cannot use the `patch` upgrade channel and still specify the patch version using `kubernetes_version`. See [the documentation](https://learn.microsoft.com/en-us/azure/aks/auto-upgrade-cluster) for more information"
100100
validation {
101-
condition = var.automatic_channel_upgrade == null ? true : contains(["patch", "stable", "rapid", "node-image"], var.automatic_channel_upgrade)
101+
condition = var.automatic_channel_upgrade == null ? true : contains([
102+
"patch", "stable", "rapid", "node-image"
103+
], var.automatic_channel_upgrade)
102104
error_message = "`automatic_channel_upgrade`'s possible values are `patch`, `stable`, `rapid` or `node-image`."
103105
}
104106
}
@@ -520,6 +522,12 @@ variable "role_based_access_control_enabled" {
520522
nullable = false
521523
}
522524

525+
variable "scale_down_mode" {
526+
type = string
527+
description = "(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."
528+
default = "Delete"
529+
}
530+
523531
variable "secret_rotation_enabled" {
524532
type = bool
525533
description = "Is secret rotation enabled? This variable is only used when `key_vault_secrets_provider_enabled` is `true` and defaults to `false`"

0 commit comments

Comments
 (0)