use*_*389 4 terraform terraform-provider-aws
我已按照 hashCorp 教程进行部署和 EKS 集群。当使用他们的 tf 文件时,它会成功初始化。如果我使用下面的 tf 文件,它会引发 terraform-aws-modules/eks 错误,并且它为什么这样做是没有意义的。
\nvariable "region" {\n default = "us-west-2"\n description = "AWS region"\n}\n\nprovider "aws" {\n region = "us-west-2"\n}\n\nprovider "kubernetes" {\n host = data.eks_cluster.cluster.endpoint\n cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)\n token = data.eks_cluster_auth.cluster.token\n load_config_file = false\n}\n\ndata "aws_availability_zones" "available" {}\n\ndata "eks_cluster" "cluster" {\n name = module.eks.cluster_id\n}\n\ndata "eks_cluster_auth" "cluster" {\n name = module.eks.cluster_id\n}\n\nlocals {\n cluster_name = "development-eks-${random_string.suffix.result}"\n}\n\nresource "random_string" "suffix" {\n length = 8\n special = false\n}\n\n\nmodule "eks" {\n source = "terraform-aws-modules/eks/aws"\n cluster_name = local.cluster_name\n cluster_version = "1.17"\n subnets = ["subnet-021510f2a4ad98fad","subnet-09ebbc7929c3859b4", "subnet-0a80ba106a29de364"]\n vpc_id = "vpc-5b230723"\n\n tags = {\n environment = "development"\n }\n\n worker_groups = [\n {\n name = "worker-group-1"\n instance_type = "t2.samll"\n asg_desired_capacity = 2\n additional_security_group_ids = [aws_security_group.worker_group_mgmt_one.id]\n }\n ]\n}\n
Run Code Online (Sandbox Code Playgroud)\n正在初始化模块...\n正在下载 eks 的 terraform-aws-modules/eks/aws 17.1.0...
\n正在初始化后端...
\n正在初始化提供者插件...
\n合作伙伴和社区提供商由其开发人员签名。\n如果您想了解有关提供商签名的更多信息,可以在此处阅读:\n https://www.terraform.io/docs/cli/plugins/signing .html
\n错误: 无法查询可用的提供程序包\n无法检索提供程序 hashicorp/eks 的可用版本列表: 提供程序注册表registry.terraform.io 没有名为registry.terraform.io/hashicorp/eks 的提供程序
\n所有模块都应指定其 required_providers ,以便外部使用者在使用模块时获得正确的提供者。要查看哪些模块当前依赖于 hashcorp/eks,请运行以下命令:terraformproviders
\nProviders required by configuration:\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/kubernetes] >= 2.0.1\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/aws] 3.43.0\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/random] 3.0.0\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/local] 2.0.0\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/eks]\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/null] 3.0.0\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/template] 2.2.0\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 module.eks\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/aws] >= 3.40.0\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/local] >= 1.4.0\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/kubernetes] >= 1.11.1\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/terraform-aws-modules/http] >= 2.4.1\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 module.fargate\n \xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/aws] >= 3.40.0\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 module.node_groups\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/aws] >= 3.43.0\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 provider[registry.terraform.io/hashicorp/cloudinit]\n
Run Code Online (Sandbox Code Playgroud)\n这是我的版本文件
\nterraform {\n required_providers {\n aws = {\n source = "hashicorp/aws"\n version = "3.43.0"\n }\n\n random = {\n source = "hashicorp/random"\n version = "3.0.0"\n }\n\n local = {\n source = "hashicorp/local"\n version = "2.0.0"\n }\n\n null = {\n source = "hashicorp/null"\n version = "3.0.0"\n }\n\n template = {\n source = "hashicorp/template"\n version = "2.2.0"\n }\n\n kubernetes = {\n source = "hashicorp/kubernetes"\n version = ">= 2.0.1"\n }\n }\n\n required_version = ">= 1.0"\n}\n\n
Run Code Online (Sandbox Code Playgroud)\n
小智 9
验证您的资源的名称...这发生在我身上,我花了相当多的时间试图弄清楚它。最终,这是一个愚蠢的错误。
在您的情况下,数据块中的资源名称必须是 aws_eks_cluster,并且您有 eks_cluster。这就对了。
归档时间: |
|
查看次数: |
7623 次 |
最近记录: |