-
-
Couldn't load subscription status.
- Fork 4.3k
Description
Description
I ran into the issue that Terraform fails to apply the calculated plan to set up EKS and import it into Rancher on a new project without existing state.
Plan fails with an error where the kubernetes provider (released on 2021-10-19) complains about an nonexisting context.
After some experimenting it turns out that the issue can be avoided by using kubernetes provider in Vaersion <2.6.0.
I am not sure whether it is an issue of the EKS module or in kubernetes provider.
Versions
- Terraform: 1.0.9
- Provider(s):
.
├── provider[registry.terraform.io/gavinbunney/kubectl] ~> 1.7
├── provider[registry.terraform.io/hashicorp/aws] ~> 3.15
├── provider[registry.terraform.io/rancher/rancher2] < 1.20.0
├── provider[registry.terraform.io/gitlabhq/gitlab] ~> 3.1
├── provider[registry.terraform.io/hashicorp/helm] ~> 2.2
├── provider[registry.terraform.io/hashicorp/random] ~> 3.0
├── provider[registry.terraform.io/hashicorp/kubernetes] ~> 2.0
├── module.eks
│ ├── provider[registry.terraform.io/hashicorp/aws] >= 3.44.0
│ ├── provider[registry.terraform.io/rancher/rancher2] >= 1.12.0
│ ├── provider[registry.terraform.io/hashicorp/kubernetes]
│ ├── module.vpc
│ │ └── provider[registry.terraform.io/hashicorp/aws] >= 3.63.0
│ └── module.eks
│ ├── provider[registry.terraform.io/hashicorp/cloudinit] >= 2.0.0
│ ├── provider[registry.terraform.io/terraform-aws-modules/http] >= 2.4.1
│ ├── provider[registry.terraform.io/hashicorp/aws] >= 3.56.0
│ ├── provider[registry.terraform.io/hashicorp/local] >= 1.4.0
│ ├── provider[registry.terraform.io/hashicorp/kubernetes] >= 1.11.1
│ ├── module.fargate
│ └── provider[registry.terraform.io/hashicorp/aws] >= 3.40.0
│ └── module.node_groups
│ ├── provider[registry.terraform.io/hashicorp/aws] >= 3.56.0
│ └── provider[registry.terraform.io/hashicorp/cloudinit] >= 2.0.0
└── module.subnets
Reproduction
Steps to reproduce the behavior:
Createan EKS cluster with enabled creation of aws-auth using the latest versions of the EKS module and kubernetes provider.
Code Snippet to Reproduce
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 17.0"
cluster_name = var.cluster_name
cluster_version = var.cluster_version
subnets = module.vpc.private_subnets
vpc_id = module.vpc.vpc_id
enable_irsa = true
write_kubeconfig = true
kubeconfig_output_path = ".kube/config"
cluster_enabled_log_types = var.cluster_enabled_log_types
cluster_log_retention_in_days = var.cluster_log_retention
manage_aws_auth = true
worker_create_initial_lifecycle_hooks = true
map_roles = ...
node_groups = ...
}
(Omitted in the snippet is the map_roles and node_groups parameter values)
Expected behavior
Actual behavior
Terminal Output Screenshot(s)
tg plan -out tf.plan
╷
│ Error: Provider configuration: cannot load Kubernetes client config
│
│ with module.eks.provider["registry.terraform.io/hashicorp/kubernetes"],
│ on .terraform/modules/eks/main.tf line 69, in provider "kubernetes":
│ 69: provider "kubernetes" {
│
│ context "eks" does not exist
╵
╷
│ Error: error reading EKS Cluster (eks): couldn't find resource
│
│ with module.eks.module.eks.module.node_groups.data.aws_eks_cluster.default[0],
│ on .terraform/modules/eks.eks/modules/node_groups/locals.tf line 1, in data "aws_eks_cluster" "default":
│ 1: data "aws_eks_cluster" "default" {
│
╵
ERRO[0018] 1 error occurred:
* exit status 1
Additional context
Fixing kubernetes provider to <2.6.0 fixes the issue:
Providers required by configuration:
.
├── provider[registry.terraform.io/gavinbunney/kubectl] ~> 1.7
├── provider[registry.terraform.io/hashicorp/aws] ~> 3.15
├── provider[registry.terraform.io/rancher/rancher2] < 1.20.0
├── provider[registry.terraform.io/gitlabhq/gitlab] ~> 3.1
├── provider[registry.terraform.io/hashicorp/helm] ~> 2.2
├── provider[registry.terraform.io/hashicorp/random] ~> 3.0
├── provider[registry.terraform.io/hashicorp/kubernetes] ~> 2.0, < 2.6.0
├── module.eks
│ ├── provider[registry.terraform.io/hashicorp/aws] >= 3.44.0
│ ├── provider[registry.terraform.io/rancher/rancher2] >= 1.12.0
│ ├── provider[registry.terraform.io/hashicorp/kubernetes]
│ ├── module.vpc
│ │ └── provider[registry.terraform.io/hashicorp/aws] >= 3.63.0
│ └── module.eks
│ ├── provider[registry.terraform.io/hashicorp/cloudinit] >= 2.0.0
│ ├── provider[registry.terraform.io/terraform-aws-modules/http] >= 2.4.1
│ ├── provider[registry.terraform.io/hashicorp/aws] >= 3.56.0
│ ├── provider[registry.terraform.io/hashicorp/local] >= 1.4.0
│ ├── provider[registry.terraform.io/hashicorp/kubernetes] >= 1.11.1
│ ├── module.fargate
│ └── provider[registry.terraform.io/hashicorp/aws] >= 3.40.0
│ └── module.node_groups
│ ├── provider[registry.terraform.io/hashicorp/aws] >= 3.56.0
│ └── provider[registry.terraform.io/hashicorp/cloudinit] >= 2.0.0
└── module.subnets