terraform-aws-eks-blueprints icon indicating copy to clipboard operation
terraform-aws-eks-blueprints copied to clipboard

The argument "name" is required, but no definition was found

Open bankcomtech opened this issue 2 years ago • 3 comments

  • [ ] ✋ I have searched the open/closed issues and my issue is not listed.

Dear everyone I am using module eks_blueprints_kubernetes_addons module "eks_blueprints_kubernetes_addons" { source = "github.com/aws-ia/terraform-aws-eks-blueprints//modules/kubernetes-addons?ref=v4.19.0"

eks_cluster_id = module.eks.cluster_id

enable_aws_load_balancer_controller = true enable_cluster_autoscaler = true enable_metrics_server = true enable_aws_node_termination_handler = false #https://github.com/aws-ia/terraform-aws-eks-blueprints/pull/1227

depends_on = [ module.eks ]

}

I have error when I running terraform upgrade 1.23 to 1.24 EKS:

│ Warning: "default_secret_name" is no longer applicable for Kubernetes v1.24.0 and above │ │ with module.eks_blueprints_kubernetes_addons.module.aws_load_balancer_controller[0].module.helm_addon.module.irsa[0].kubernetes_service_account_v1.irsa[0], │ on .terraform/modules/eks_blueprints_kubernetes_addons/modules/irsa/main.tf line 16, in resource "kubernetes_service_account_v1" "irsa": │ 16: resource "kubernetes_service_account_v1" "irsa" { │ │ Starting from version 1.24.0 Kubernetes does not automatically generate a token for service accounts, in this case, "default_secret_name" will be empty ╵

Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.

Enter a value: yes

module.eks_blueprints_kubernetes_addons.data.aws_caller_identity.current: Reading... module.eks_blueprints_kubernetes_addons.data.aws_region.current: Reading... module.eks_blueprints_kubernetes_addons.data.aws_partition.current: Reading... module.eks_blueprints_kubernetes_addons.data.aws_partition.current: Read complete after 0s [id=aws] module.eks_blueprints_kubernetes_addons.data.aws_region.current: Read complete after 0s [id=ap-northeast-1] module.eks_blueprints_kubernetes_addons.data.aws_caller_identity.current: Read complete after 2s [id=039067682568] ╷ │ Error: Missing required argument │ │ with module.eks_blueprints_kubernetes_addons.data.aws_eks_cluster.eks_cluster, │ on .terraform/modules/eks_blueprints_kubernetes_addons/modules/kubernetes-addons/data.tf line 16, in data "aws_eks_cluster" "eks_cluster": │ 16: name = time_sleep.dataplane.triggers["eks_cluster_id"] │ │ The argument "name" is required, but no definition was found. ╵

Who help us to resolve this issue?

Additional context

bankcomtech avatar Dec 18 '22 11:12 bankcomtech

I ran into this issue too provisioning a new cluster. I was able to work around it by restricting the aws provider to 4.45.0 like this:

aws = { source = "hashicorp/aws" version = ">= 3.72, < 4.46.0" }

~~there was a breaking change in the terraform-eks-provider between 18.x and 19.x versions. Details here: https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/docs/UPGRADE-19.0.md~~

~~Those changes probably need to be incorporated into this blueprint~~ As noted below this is not relevent

melissafritcher avatar Dec 18 '22 21:12 melissafritcher

the changes to the EKS module (v18 to v19) have no influence on this issue since blueprints still uses v18

@bankcomtech can you:

  1. Format your output above with code block(s)
  2. Provide the configuration you are currently using that produced this error

bryantbiggs avatar Dec 21 '22 12:12 bryantbiggs

Hi @bankcomtech

Looks like you might be mixing up eks_cluster_id output variable and eks_cluster_name. Can you check that eks_cluster_id that you are passing to the addons module (like this: eks_cluster_id = module.eks.cluster_id at the top of your comment) is not null?

If you use the official AWS Terraform EKS Cluster module with these addons (like I do) then you might have run into this bug. The outputs.tf file for that official EKS cluster module is illuminating (snippet below).

output "cluster_id" {
  description = "The ID of the EKS cluster. Note: currently a value is returned only for local EKS clusters created on Outposts"
  value       = try(aws_eks_cluster.this[0].cluster_id, null)
}

output "cluster_name" {
  description = "The name of the EKS cluster"
  value       = try(aws_eks_cluster.this[0].name, null)
}

Note how cluster_id will return null unless you create the cluster on Outposts.

BillyUdders avatar Jan 05 '23 04:01 BillyUdders

closing for now - please feel free to provide more information here and we can revisit

bryantbiggs avatar Jan 21 '23 14:01 bryantbiggs

Have you fixed this problem?

ricardorqr avatar May 08 '23 23:05 ricardorqr

I am facing the issue. Have anyone fixed this one?

keenborder786 avatar May 30 '23 08:05 keenborder786

For anyone facing this issue and using the official aws EKS module, the problem is the eks_cluster_id = module.eks.cluster_id

the output cluster_id as stated bu @BillyUdders is null, changing to eks_cluster_id = module.eks.cluster_name as both are the same solved the issue for me.

SalahBellagnaoui avatar Aug 08 '23 02:08 SalahBellagnaoui

hello :)

ngueagho avatar Aug 29 '23 18:08 ngueagho