我已按照 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 …
Run Code Online (Sandbox Code Playgroud)