Closed zack-is-cool closed 1 year ago
I'm looking at this closer double checking that it's not an issue with input causing the count on aws_node_termination_handler
to be 0.
# inputs when calling module...
auto_scaling_group_names = concat(lookup(module.aws_eks.self_managed_node_groups, "autoscaling_group_name", []), lookup(module.aws_eks.eks_managed_node_groups, "node_group_autoscaling_group_names", []))
# terraform-aws-eks-blueprints/modules/kubernetes-addons/main.tf
#...
module "aws_node_termination_handler" {
count = var.enable_aws_node_termination_handler && (length(var.auto_scaling_group_names) > 0 || var.enable_karpenter) ? 1 : 0
source = "./aws-node-termination-handler"
helm_config = var.aws_node_termination_handler_helm_config
manage_via_gitops = var.argocd_manage_add_ons
irsa_policies = var.aws_node_termination_handler_irsa_policies
autoscaling_group_names = var.auto_scaling_group_names
addon_context = local.addon_context
}
edit:
Yeah I just need to use eks_managed_node_groups_autoscaling_group_names
and self_managed_node_groups_autoscaling_group_names
as my inputs.
Description
We're currently using blueprints specifically for modules/kubernetes-addons.
I'm getting this error with
enable_aws_node_termination_handler
set to trueI am not defining
manage_via_gitops
, so it's defaulting to false via the variable block. There is an output tied to this that returns null:Blueprints references this output in
terraform-aws-eks-blueprints/locals.tf
(here) without a try block and tries iterating over a null:I think an easy solution would be to wrap all of these
argocd_addon_config
interraform-aws-eks-blueprints/modules/kubernetes-addons/locals.tf
configs intry()
functions and defaulting to null?Versions
Module version [Required]: 4.27.0
Terraform version:
provider registry.terraform.io/gavinbunney/kubectl v1.14.0
provider registry.terraform.io/hashicorp/aws v4.61.0
provider registry.terraform.io/hashicorp/cloudinit v2.3.2
provider registry.terraform.io/hashicorp/helm v2.9.0
provider registry.terraform.io/hashicorp/kubernetes v2.19.0
provider registry.terraform.io/hashicorp/local v2.4.0
provider registry.terraform.io/hashicorp/null v3.2.1
provider registry.terraform.io/hashicorp/random v3.4.3
provider registry.terraform.io/hashicorp/time v0.9.1
provider registry.terraform.io/hashicorp/tls v4.0.4
provider registry.terraform.io/terraform-aws-modules/http v2.4.1
Your version of Terraform is out of date! The latest version is 1.4.4. You can update by downloading from https://www.terraform.io/downloads.html
enable_aws_node_termination_handler
- is set to trueaws_node_termination_handler_helm_config
- null atmWe don't want to use argo
Expected behaviour
Handle nulls safely
Actual behaviour