Skip to content

Commit

Permalink
fix: Add variables to configure availability zones in aks cluster (#47)
Browse files Browse the repository at this point in the history
Co-authored-by: pasqualedevita <>
  • Loading branch information
pasqualedevita authored Jan 25, 2023
1 parent 8989df3 commit d73c734
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kubernetes_cluster/01_main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "azurerm_kubernetes_cluster" "this" {
os_disk_size_gb = var.system_node_pool_os_disk_size_gb
type = "VirtualMachineScaleSets"
only_critical_addons_enabled = var.system_node_pool_only_critical_addons_enabled
zones = ["1", "2", "3"]
zones = var.system_node_pool_availability_zones
ultra_ssd_enabled = var.system_node_pool_ultra_ssd_enabled
enable_host_encryption = var.system_node_pool_enable_host_encryption

Expand Down Expand Up @@ -153,7 +153,7 @@ resource "azurerm_kubernetes_cluster_node_pool" "this" {
# https://docs.microsoft.com/en-us/azure/virtual-machines/sizes-general
os_disk_type = var.user_node_pool_os_disk_type # Managed or Ephemeral
os_disk_size_gb = var.user_node_pool_os_disk_size_gb
zones = ["1", "2", "3"]
zones = var.user_node_pool_availability_zones
ultra_ssd_enabled = var.user_node_pool_ultra_ssd_enabled
enable_host_encryption = var.user_node_pool_enable_host_encryption
os_type = "Linux"
Expand Down
12 changes: 12 additions & 0 deletions kubernetes_cluster/99_variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ variable "system_node_pool_ultra_ssd_enabled" {
default = false
}

variable "system_node_pool_availability_zones" {
type = list(string)
description = "(Optional) List of availability zones for system node pool"
default = ["1", "2", "3"]
}

variable "system_node_pool_tags" {
type = map(any)
description = "(Optional) A mapping of tags to assign to the Node Pool."
Expand Down Expand Up @@ -182,6 +188,12 @@ variable "user_node_pool_ultra_ssd_enabled" {
default = false
}

variable "user_node_pool_availability_zones" {
type = list(string)
description = "(Optional) List of availability zones for user node pool"
default = ["1", "2", "3"]
}

variable "user_node_pool_tags" {
type = map(any)
description = "(Optional) A mapping of tags to assign to the Node Pool."
Expand Down
2 changes: 2 additions & 0 deletions kubernetes_cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,7 @@ No modules.
| <a name="input_sec_log_analytics_workspace_id"></a> [sec\_log\_analytics\_workspace\_id](#input\_sec\_log\_analytics\_workspace\_id) | Log analytics workspace security (it should be in a different subscription). | `string` | `null` | no |
| <a name="input_sec_storage_id"></a> [sec\_storage\_id](#input\_sec\_storage\_id) | Storage Account security (it should be in a different subscription). | `string` | `null` | no |
| <a name="input_sku_tier"></a> [sku\_tier](#input\_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) | `string` | `"Free"` | no |
| <a name="input_system_node_pool_availability_zones"></a> [system\_node\_pool\_availability\_zones](#input\_system\_node\_pool\_availability\_zones) | (Optional) List of availability zones for system node pool | `list(string)` | <pre>[<br> "1",<br> "2",<br> "3"<br>]</pre> | no |
| <a name="input_system_node_pool_enable_host_encryption"></a> [system\_node\_pool\_enable\_host\_encryption](#input\_system\_node\_pool\_enable\_host\_encryption) | (Optional) Should the nodes in the Default Node Pool have host encryption enabled? Defaults to true. | `bool` | `true` | no |
| <a name="input_system_node_pool_max_pods"></a> [system\_node\_pool\_max\_pods](#input\_system\_node\_pool\_max\_pods) | (Optional) The maximum number of pods that can run on each agent. Changing this forces a new resource to be created. | `number` | `250` | no |
| <a name="input_system_node_pool_name"></a> [system\_node\_pool\_name](#input\_system\_node\_pool\_name) | (Required) The name which should be used for the default Kubernetes Node Pool. Changing this forces a new resource to be created. | `string` | n/a | yes |
Expand All @@ -733,6 +734,7 @@ No modules.
| <a name="input_system_node_pool_vm_size"></a> [system\_node\_pool\_vm\_size](#input\_system\_node\_pool\_vm\_size) | (Required) The size of the Virtual Machine, such as Standard\_B4ms or Standard\_D4s\_vX. See https://pagopa.atlassian.net/wiki/spaces/DEVOPS/pages/134840344/Best+practice+su+prodotti | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(any)` | n/a | yes |
| <a name="input_upgrade_settings_max_surge"></a> [upgrade\_settings\_max\_surge](#input\_upgrade\_settings\_max\_surge) | The maximum number or percentage of nodes which will be added to the Node Pool size during an upgrade. | `string` | `"33%"` | no |
| <a name="input_user_node_pool_availability_zones"></a> [user\_node\_pool\_availability\_zones](#input\_user\_node\_pool\_availability\_zones) | (Optional) List of availability zones for user node pool | `list(string)` | <pre>[<br> "1",<br> "2",<br> "3"<br>]</pre> | no |
| <a name="input_user_node_pool_enable_host_encryption"></a> [user\_node\_pool\_enable\_host\_encryption](#input\_user\_node\_pool\_enable\_host\_encryption) | (Optional) Should the nodes in the Default Node Pool have host encryption enabled? Defaults to true. | `bool` | `false` | no |
| <a name="input_user_node_pool_enabled"></a> [user\_node\_pool\_enabled](#input\_user\_node\_pool\_enabled) | Is user node pool enabled? | `bool` | `false` | no |
| <a name="input_user_node_pool_max_pods"></a> [user\_node\_pool\_max\_pods](#input\_user\_node\_pool\_max\_pods) | (Optional) The maximum number of pods that can run on each agent. Changing this forces a new resource to be created. | `number` | `250` | no |
Expand Down

0 comments on commit d73c734

Please sign in to comment.