gpt4 book ai didi

terraform - "v"参数 : cannot convert "" to number; given string terraform eks modules 的值无效

转载 作者:行者123 更新时间:2023-12-04 08:47:52 25 4
gpt4 key购买 nike

我用 terraform eks 模块创建了以下 eks 集群。

module "myeks" {
source = "terraform-aws-modules/eks/aws"
cluster_name = var.project
version = "7.0.1"
cluster_version = var.eks_version
subnets = data.aws_subnet_ids.subnet_ids.ids
vpc_id = var.vpc_id

worker_groups = [
{
name = "worker-group-1"
instance_type = "m5.large"
asg_max_size = 2
}
]
}
但问题是当我在 gitlabci 中运行该代码时,我遇到了以下错误消息。
Error: Invalid function argument
on .terraform/modules/myeks/data.tf line 6, in locals:
6: var.worker_ami_name_filter_windows : "Windows_Server-2019-English-Core-EKS_Optimized-${tonumber(var.cluster_version) >= 1.14 ? var.cluster_version : 1.14}-*"
|----------------
| var.cluster_version is ""
Invalid value for "v" parameter: cannot convert "" to number; given string
must be a decimal representation of a number.
Error: Your query returned no results. Please change your search criteria and try again.
on .terraform/modules/myeks/data.tf line 25, in data "aws_ami" "eks_worker":
25: data "aws_ami" "eks_worker" {
但是当我做 terraform plan在本地机器上,它工作正常。
那是我的tfvars。
vpc_id        = "vpc-xxxxx"
environment = "dev"
eks_version = "1.17"
project = "mypro"

最佳答案

根据评论。
问题是由于 var.eks_version是空的。这是由 引起的未映射 .tfvarsgitlabci .
解决方案是在 gitlabci 中添加缺少的映射.

关于terraform - "v"参数 : cannot convert "" to number; given string terraform eks modules 的值无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64218923/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com