我遵循了关于部署和EKS集群的hashiCorp教程。当使用他们的tf文件时,它会成功。如果我在下面使用我的tf文件,它会为terraform-aws-模块/ek抛出一个错误,它这样做是毫无意义的。
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]
}
]
}初始化模块..。下载terraform-aws-模块/ek/aws 17.1.0 .
.terraform\modules\eks
中的
初始化后端..。
初始化提供者插件..。
查找与“2.0.0"...
H 233
Installing HashiCorp/ v2.2.0...
Installed hashicorp/template v2.2.0签名)(由HashiCorp)
Installing hashicorp/kubernetes v2.3.2...
Installed hashicorp/kubernetes v2.3.2签名)(由HashiCorp)
Installing hashicorp/aws v3.43.0...
Installed HashiCorp/awsv3.43.0(由HashiCorp签名)h 247
Installed hashicorp/code> v3.0.0 (由HashiCorp)
Installing terraform-aws/http v2.4.1...
Installed terraform-aws/http v2.4.1 (自签名)签署)键ID B2C1C0641B6B0EB7)
Installing hashicorp/cloudinit v2.2.0...
Installed hashicorp/cloudinit v2.2.0 (由HashiCorp签名)合作伙伴和社区提供者由他们的开发人员签名。如果您想了解更多关于提供者签名的信息,可以在这里阅读:https://www.terraform.io/docs/cli/plugins/signing.html
registry.terraform.io/hashicorp/eks错误:未能查询可用的提供程序包,无法检索提供程序hashicorp/的可用版本列表:提供程序注册表registry.terraform.io没有名为的提供程序
所有模块都应该指定它们的required_providers,以便外部使用者在使用模块时获得正确的提供者。要查看哪些模块当前取决于hashicorp/ek,请运行以下命令:terraform提供程序
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"
}发布于 2022-06-30 17:36:33
验证你资源的名字..。这件事发生在我身上,我花了相当长的时间想办法弄清楚。最后,这是一个愚蠢的错误。
在您的示例中,数据块中的资源名称必须是aws_eks_cluster,并且您有eks_cluster。就是这样。
https://stackoverflow.com/questions/68383792
复制相似问题