s00*_*433 1 kubernetes terraform amazon-eks
我的地形文件如下。
\ndata "aws_eks_cluster" "cluster" {\n name = module.eks.cluster_name\n}\n\ndata "aws_eks_cluster_auth" "cluster" {\n name = module.eks.cluster_name\n}\n\nprovider "kubernetes" {\n host = data.aws_eks_cluster.cluster.endpoint\n cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)\n token = data.aws_eks_cluster_auth.cluster.token\n}\n\nmodule "eks" {\n source = "terraform-aws-modules/eks/aws"\n version = "19.5.1" //19.0 version created the ingress security group for us\n...}\nRun Code Online (Sandbox Code Playgroud)\n运行“terraform plan”时,出现错误:
\n\n\xe2\x94\x82 Error: reading EKS Cluster (ccc): couldn\'t find resource\n\xe2\x94\x82 \n\xe2\x94\x82 with data.aws_eks_cluster.cluster,\n\xe2\x94\x82 on main.tf line 7, in data "aws_eks_cluster" "cluster":\n\xe2\x94\x82 7: data "aws_eks_cluster" "cluster" {\n\xe2\x94\x82 \n\xe2\x95\xb5\nRun Code Online (Sandbox Code Playgroud)\n
我添加depends_on到我的数据列并且它起作用了。
data "aws_eks_cluster" "calocalc-cluster" {
name = var.cluster_name
depends_on = [module.eks.cluster_name]
}
Run Code Online (Sandbox Code Playgroud)
小智 5
尝试删除数据资源并使用以下 kubernetes 提供程序:
provider "kubernetes" {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)
exec {
api_version = "client.authentication.k8s.io/v1beta1"
command = "aws"
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_name]
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3119 次 |
| 最近记录: |