无法检索提供商 hashicorp/eks 的可用版本列表

use*_*389 4 terraform terraform-provider-aws

我已按照 hashCorp 教程进行部署和 EKS 集群。当使用他们的 tf 文件时,它会成功初始化。如果我使用下面的 tf 文件,它会引发 terraform-aws-modules/eks 错误,并且它为什么这样做是没有意义的。

\n
variable "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
  • .terraform\\modules\\eks 中的 eks
  • \n
  • .terraform\\modules\\eks\\modules\\fargate 中的 eks.fargate
  • \n
  • .terraform\\modules\\eks\\modules\\node_groups 中的 eks.node_groups
  • \n
\n

正在初始化后端...

\n

正在初始化提供者插件...

\n
    \n
  • 正在查找匹配“>= 1.4.0, 2.0.0”的 hashcorp/local 版本...
  • \n
  • 查找与“3.0.0”匹配的 hashcorp/null 版本...
  • \n
  • 正在查找与“2.2.0”匹配的 hashcorp/模板版本...
  • \n
  • 正在查找 hashicorp/kubernetes 版本匹配 >= 1.11.1, >= 2.0.1"...
  • \n
  • 正在寻找最新版本的 hashcorp/eks...
  • \n
  • 正在查找匹配 ">= 3.40.0, >= 3.43.0, 3.43.0" 的 hashcorp/aws 版本...
  • \n
  • 正在查找匹配“3.0.0”的 hashcorp/random 版本...
  • \n
  • 正在查找 terraform-aws-modules/http 版本匹配 ">= 2.4.1"...
  • \n
  • 正在查找最新版本的 hashcorp/cloudinit...
  • \n
  • 正在安装 hashcorp/local v2.0.0...
  • \n
  • 安装hashicorp/local v2.0.0(由HashiCorp签名)
  • \n
  • 正在安装 hashcorp/null v3.0.0...
  • \n
  • 安装hashicorp/null v3.0.0(由HashiCorp签名)
  • \n
  • 正在安装 hashcorp/template v2.2.0...
  • \n
  • 安装hashicorp/template v2.2.0(由HashiCorp签名)
  • \n
  • 正在安装 hashcorp/kubernetes v2.3.2...
  • \n
  • 安装hashicorp/kubernetes v2.3.2(由HashiCorp签名)
  • \n
  • 正在安装 hashcorp/aws v3.43.0...
  • \n
  • 安装了 hashcorp/aws v3.43.0(由 HashiCorp 签名)
  • \n
  • 正在安装 hashcorp/random v3.0.0...
  • \n
  • 安装hashicorp/random v3.0.0(由HashiCorp签名)
  • \n
  • 正在安装 terraform-aws-modules/http v2.4.1...
  • \n
  • 已安装 terraform-aws-modules/http v2.4.1(自签名,密钥 ID B2C1C0641B6B0EB7)
  • \n
  • 正在安装 hashcorp/cloudinit v2.2.0...
  • \n
  • 安装hashicorp/cloudinit v2.2.0(由HashiCorp签名)
  • \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

\n
Providers 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

这是我的版本文件

\n
terraform {\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。这就对了。