无法检索提供程序 hashicorp/eks

时间:2021-07-14 19:03:47

标签: terraform terraform-provider-aws

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

variable "region" {
  default     = "us-west-2"
  description = "AWS region"
}

provider "aws" {
  region = "us-west-2"
}

provider "kubernetes" {
  host                   = data.eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  token                  = data.eks_cluster_auth.cluster.token
  load_config_file       = false
}

data "aws_availability_zones" "available" {}

data "eks_cluster" "cluster" {
  name = module.eks.cluster_id
}

data "eks_cluster_auth" "cluster" {
  name = module.eks.cluster_id
}

locals {
  cluster_name = "development-eks-${random_string.suffix.result}"
}

resource "random_string" "suffix" {
  length  = 8
  special = false
}


module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  cluster_name    = local.cluster_name
  cluster_version = "1.17"
  subnets         = ["subnet-021510f2a4ad98fad","subnet-09ebbc7929c3859b4", "subnet-0a80ba106a29de364"]
  vpc_id          = "vpc-5b230723"

  tags = {
    environment = "development"
  }

  worker_groups = [
    {
      name                          = "worker-group-1"
      instance_type                 = "t2.samll"
      asg_desired_capacity          = 2
      additional_security_group_ids = [aws_security_group.worker_group_mgmt_one.id]
    }
  ]
}

正在初始化模块... 正在为 eks 下载 terraform-aws-modules/eks/aws 17.1.0...

  • .terraform\modules\eks 中的 eks
  • .terraform\modules\eks\modules\fargate 中的 eks.fargate
  • .terraform\modules\eks\modules\node_groups 中的 eks.node_groups

正在初始化后端...

正在初始化提供程序插件...

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

合作伙伴和社区提供商由其开发者签署。 如果您想了解有关提供商签名的更多信息,可以在此处阅读: https://www.terraform.io/docs/cli/plugins/signing.html

错误:无法查询可用的提供程序包 无法检索提供者 hashicorp/eks 的可用版本列表:提供者注册表 registry.terraform.io 没有名为 registry.terraform.io/hashicorp/eks 的提供者

所有模块都应该指定他们的 required_providers 以便外部消费者在使用模块时可以获得正确的提供者。要查看当前依赖于 hashicorp/eks 的模块,请运行以下命令:terraform providers

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/kubernetes] >= 2.0.1
├── provider[registry.terraform.io/hashicorp/aws] 3.43.0
├── provider[registry.terraform.io/hashicorp/random] 3.0.0
├── provider[registry.terraform.io/hashicorp/local] 2.0.0
├── provider[registry.terraform.io/hashicorp/eks]
├── provider[registry.terraform.io/hashicorp/null] 3.0.0
├── provider[registry.terraform.io/hashicorp/template] 2.2.0
└── module.eks
    ├── provider[registry.terraform.io/hashicorp/aws] >= 3.40.0
    ├── provider[registry.terraform.io/hashicorp/local] >= 1.4.0
    ├── provider[registry.terraform.io/hashicorp/kubernetes] >= 1.11.1
    ├── provider[registry.terraform.io/terraform-aws-modules/http] >= 2.4.1
    ├── module.fargate
    │   └── provider[registry.terraform.io/hashicorp/aws] >= 3.40.0
    └── module.node_groups
        ├── provider[registry.terraform.io/hashicorp/aws] >= 3.43.0
        └── provider[registry.terraform.io/hashicorp/cloudinit]

这是我的版本文件

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.43.0"
    }

    random = {
      source  = "hashicorp/random"
      version = "3.0.0"
    }

    local = {
      source  = "hashicorp/local"
      version = "2.0.0"
    }

    null = {
      source  = "hashicorp/null"
      version = "3.0.0"
    }

    template = {
      source  = "hashicorp/template"
      version = "2.2.0"
    }

    kubernetes = {
      source  = "hashicorp/kubernetes"
      version = ">= 2.0.1"
    }
  }

  required_version = ">= 1.0"
}

0 个答案:

没有答案
相关问题