From 902f088aa0149232c4bae9377c6466f3288b2cd6 Mon Sep 17 00:00:00 2001 From: Ihor Urazov Date: Tue, 26 Nov 2024 15:31:21 +0200 Subject: [PATCH] Add support for upgrade policy configuration --- README.md | 1 + docs/terraform.md | 1 + examples/complete/fixtures.us-east-2.tfvars | 4 ++++ examples/complete/main.tf | 1 + examples/complete/variables.tf | 8 ++++++++ main.tf | 7 +++++++ variables.tf | 8 ++++++++ 7 files changed, 30 insertions(+) diff --git a/README.md b/README.md index 7506f3c..5f0bffa 100644 --- a/README.md +++ b/README.md @@ -454,6 +454,7 @@ Available targets: | [subnet\_ids](#input\_subnet\_ids) | A list of subnet IDs to launch the cluster in | `list(string)` | n/a | yes | | [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no | | [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no | +| [upgrade\_policy](#input\_upgrade\_policy) | Configuration block for the support policy to use for the cluster |
object({
support_type = optional(string, null)
})
| `null` | no | | [zonal\_shift\_config](#input\_zonal\_shift\_config) | Configuration block with zonal shift configuration for the cluster |
object({
enabled = optional(bool, null)
})
| `null` | no | ## Outputs diff --git a/docs/terraform.md b/docs/terraform.md index 03d4e31..dbc7b9f 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -109,6 +109,7 @@ | [subnet\_ids](#input\_subnet\_ids) | A list of subnet IDs to launch the cluster in | `list(string)` | n/a | yes | | [tags](#input\_tags) | Additional tags (e.g. `{'BusinessUnit': 'XYZ'}`).
Neither the tag keys nor the tag values will be modified by this module. | `map(string)` | `{}` | no | | [tenant](#input\_tenant) | ID element \_(Rarely used, not included by default)\_. A customer identifier, indicating who this instance of a resource is for | `string` | `null` | no | +| [upgrade\_policy](#input\_upgrade\_policy) | Configuration block for the support policy to use for the cluster |
object({
support_type = optional(string, null)
})
| `null` | no | | [zonal\_shift\_config](#input\_zonal\_shift\_config) | Configuration block with zonal shift configuration for the cluster |
object({
enabled = optional(bool, null)
})
| `null` | no | ## Outputs diff --git a/examples/complete/fixtures.us-east-2.tfvars b/examples/complete/fixtures.us-east-2.tfvars index 89febe6..9ebd76a 100644 --- a/examples/complete/fixtures.us-east-2.tfvars +++ b/examples/complete/fixtures.us-east-2.tfvars @@ -50,6 +50,10 @@ addons = [ }, ] +upgrade_policy = { + support_type = "STANDARD" +} + zonal_shift_config = { enabled = true } diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 68f378f..40f4a89 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -113,6 +113,7 @@ module "eks_cluster" { addons = local.addons addons_depends_on = [module.eks_node_group] bootstrap_self_managed_addons_enabled = var.bootstrap_self_managed_addons_enabled + upgrade_policy = var.upgrade_policy zonal_shift_config = var.zonal_shift_config access_entry_map = local.access_entry_map diff --git a/examples/complete/variables.tf b/examples/complete/variables.tf index 45a4f84..18fee22 100644 --- a/examples/complete/variables.tf +++ b/examples/complete/variables.tf @@ -115,6 +115,14 @@ variable "bootstrap_self_managed_addons_enabled" { default = null } +variable "upgrade_policy" { + type = object({ + support_type = optional(string, null) + }) + description = "Configuration block for the support policy to use for the cluster" + default = null +} + variable "zonal_shift_config" { type = object({ enabled = optional(bool, null) diff --git a/main.tf b/main.tf index ed54916..59716b0 100644 --- a/main.tf +++ b/main.tf @@ -110,6 +110,13 @@ resource "aws_eks_cluster" "default" { } } + dynamic "upgrade_policy" { + for_each = var.upgrade_policy != null ? [var.upgrade_policy] : [] + content { + support_type = upgrade_policy.value.support_type + } + } + dynamic "zonal_shift_config" { for_each = var.zonal_shift_config != null ? [var.zonal_shift_config] : [] content { diff --git a/variables.tf b/variables.tf index 6d7f201..3b18368 100644 --- a/variables.tf +++ b/variables.tf @@ -203,6 +203,14 @@ variable "bootstrap_self_managed_addons_enabled" { default = null } +variable "upgrade_policy" { + type = object({ + support_type = optional(string, null) + }) + description = "Configuration block for the support policy to use for the cluster" + default = null +} + variable "zonal_shift_config" { type = object({ enabled = optional(bool, null)