terraform-aws-eks-blueprints
terraform-aws-eks-blueprints copied to clipboard
[Bug]: There is no function named "defaults". in terraform 1.3 alpha
Welcome to Amazon EKS Blueprints!
- [X] Yes, I've searched similar issues on GitHub and didn't find any.
Amazon EKS Blueprints Release version
4.1
What is your environment, configuration and the example used?
module "eks_blueprints_kubernetes_addons_karpenter" {
source = "git::ssh://[email protected]/aws-ia/terraform-aws-eks-blueprints.git//modules/kubernetes-addons?ref=v4.1.0"
eks_cluster_id = var.eks_cluster_id
enable_karpenter = true
karpenter_helm_config = {
cleanup_on_fail = true
force_update = true
replace = true
version = var.karpenter_helm_config_version
}
}
What did you do and What did you see instead?
https://github.com/hashicorp/terraform/issues/31282
│ Error: Call to unknown function
│
│ on .terraform/modules/base_system.karpenter.eks_blueprints_kubernetes_addons_karpenter.ondat.helm_addon/modules/kubernetes-addons/helm-addon/locals.tf line 6, in locals:
│ 6: irsa_config = defaults(var.irsa_config, {
│ 7: create_kubernetes_namespace = true
│ 8: create_kubernetes_service_account = true
│ 9: })
│ ├────────────────
│ │ var.irsa_config is a object, known only after apply
│
│ There is no function named "defaults".
╵
╷
│ Error: Call to unknown function
│
│ on .terraform/modules/base_system.karpenter.eks_blueprints_kubernetes_addons_karpenter.tetrate_istio.base/modules/kubernetes-addons/helm-addon/locals.tf line 6, in locals:
│ 6: irsa_config = defaults(var.irsa_config, {
│ 7: create_kubernetes_namespace = true
│ 8: create_kubernetes_service_account = true
│ 9: iam_role_path = "/"
│ 10: })
│ ├────────────────
│ │ var.irsa_config is a object, known only after apply
│
│ There is no function named "defaults".
╵
Additional Information
Testing Terraform v1.3.0-alpha
Terraform v1.3.0-alpha20220608
on darwin_arm64
+ provider registry.terraform.io/gavinbunney/kubectl v1.14.0
+ provider registry.terraform.io/hashicorp/aws v4.19.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/helm v2.6.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.11.0
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/random v3.3.1
+ provider registry.terraform.io/hashicorp/time v0.7.2
+ provider registry.terraform.io/hashicorp/vault v3.7.0
From the terraform maintainers:
That defaults function was part of the optional attributes experiment, and has been intentionally removed in the next phase of the experiment, which has (as of last week) been de-experimentalized and will be stable in the forthcoming v1.3.0.
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
I'm confused, I have tried 1.3.0 all the way to 1.4.4 and I get the same error. How was defaults
implemented? Is there a syntax change that needs to happen?
@paulpas
Check out https://developer.hashicorp.com/terraform/language/expressions/type-constraints#optional-object-type-attributes
You can provide the default value as the second parameter of the optional
method.