Giter Club home page Giter Club logo

Comments (1)

harsh-cldcvr avatar harsh-cldcvr commented on May 14, 2024

@jfelten Any update on this, if you can please help.

facing same issue.

can anyone please help me ?

using to create the EKS cluster
main.tf

locals {
  namespace = "test"
  stage     = "dev"

  kubernetes_version         = "1.20"
  tags                       = merge(module.label.tags, tomap({ "kubernetes.io/cluster/${module.label.id}" = "shared" }))
  eks_worker_ami_name_filter = "amazon-eks-node-${local.kubernetes_version}*"
  public_subnets_additional_tags = {
    "kubernetes.io/role/elb" : 1
  }
  private_subnets_additional_tags = {
    "kubernetes.io/role/internal-elb" : 1
  }
}

module "label" {
  source     = "cloudposse/label/null"
  version    = "0.24.1"
  attributes = ["${local.namespace}-${local.stage}-cluster"]
}

module "eks_cluster" {
  source  = "cloudposse/eks-cluster/aws"
  version = "0.39.0"

  namespace = local.namespace
  stage     = local.stage
  tags      = local.tags

  region                       = "REGION"
  vpc_id                       = data.terraform_remote_state.vpc.outputs.vpc.vpc_id
  subnet_ids                   = concat(module.subnets.private_subnet_ids, module.subnets.public_subnet_ids)
  kubernetes_version           = local.kubernetes_version
  local_exec_interpreter       = ["/bin/sh", "-c"]
  oidc_provider_enabled        = true
  enabled_cluster_log_types    = ["api"]
  cluster_log_retention_period = 7

  cluster_encryption_config_enabled                         = true
  cluster_encryption_config_kms_key_id                      = ""
  cluster_encryption_config_kms_key_enable_key_rotation     = true
  cluster_encryption_config_kms_key_deletion_window_in_days = 30
  cluster_encryption_config_kms_key_policy                  = null
  cluster_encryption_config_resources                       = ["secrets"]

  kubernetes_config_map_ignore_role_changes = var.kubernetes_config_map_ignore_role_changes
  workers_role_arns                         = var.existing_worker_role_arns
  
}

module "eks_node_group" {
  source  = "cloudposse/eks-node-group/aws"
  version = "0.20.0"

  namespace = local.namespace
  stage     = local.stage
  tags      = local.tags

  subnet_ids = module.subnets.private_subnet_ids
  cluster_name = (var.existing_cluster_name == "" ?
    module.eks_cluster.eks_cluster_id
  : var.existing_cluster_name)
  instance_types = var.instance_types
  desired_size   = var.desired_size
  min_size       = var.min_size
  max_size       = var.max_size
  disk_size      = var.vm_pd_ssd_size
}

mydata.tf

data "null_data_source" "wait_for_cluster_and_kubernetes_configmap" {
  inputs = {
    cluster_name             = module.eks_cluster.eks_cluster_id
    kubernetes_config_map_id = module.eks_cluster.kubernetes_config_map_id
  }
}

data "aws_eks_cluster" "cluster" {
  name = (var.existing_cluster_name == "" ?
    module.eks_cluster.eks_cluster_id
  : var.existing_cluster_name)
}

data "aws_eks_cluster_auth" "eks" {
  name = (var.existing_cluster_name == "" ?   data.null_data_source.wait_for_cluster_and_kubernetes_configmap.outputs["cluster_name"]
  : var.existing_cluster_name)
}

data "terraform_remote_state" "xyz" {
  backend = "s3"

  config = {
    bucket   = "BUCKET-name"
    key      = "state-key"
    region   = "REGION"
  }
}

varible.tf

variable "kubernetes_config_map_ignore_role_changes" {
  type        = bool
  default     = true
}

variable "existing_cluster_name" {
  type        = string
  default     = ""
}

i am able to create the cluster but getting the error when re-applying some changes.

Error: configmaps "aws-auth" already exists
│ 
│  with module.eks_cluster.kubernetes_config_map.aws_auth_ignore_changes[0],
│  on .terraform/modules/eks_cluster/auth.tf line 83, in resource "kubernetes_config_map" "aws_auth_ignore_changes":
│  83: resource "kubernetes_config_map" "aws_auth_ignore_changes" {

Note : while re-applying updating the value in varibles.tf for existing cluster with name of cluster.

Anyone faced this error before ?

Thanks in advance.

from terraform-aws-eks-cluster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.