Difference between revisions of "Eks-cluster.tf (version 18.26.6)"

From wikieduonline
Jump to navigation Jump to search
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
 
* https://github.com/hashicorp/learn-terraform-provision-eks-cluster/blob/main/eks-cluster.tf
 
* https://github.com/hashicorp/learn-terraform-provision-eks-cluster/blob/main/eks-cluster.tf
 +
 +
<pre>
 +
module "eks" {
 +
  source  = "terraform-aws-modules/eks/aws"
 +
  version = "18.26.6"
 +
 +
  cluster_name    = local.cluster_name
 +
  cluster_version = "1.22"
 +
 +
  vpc_id    = module.vpc.vpc_id
 +
  subnet_ids = module.vpc.private_subnets
 +
 +
  eks_managed_node_group_defaults = {
 +
    ami_type = "AL2_x86_64"
 +
 +
    attach_cluster_primary_security_group = true
 +
 +
    # Disabling and using externally provided security groups
 +
    create_security_group = false
 +
  }
 +
 +
  eks_managed_node_groups = {
 +
    one = {
 +
      name = "node-group-1"
 +
 +
      instance_types = ["t3.small"]
 +
 +
      min_size    = 1
 +
      max_size    = 3
 +
      desired_size = 2
 +
 +
      pre_bootstrap_user_data = <<-EOT
 +
      echo 'foo bar'
 +
      EOT
 +
 +
      vpc_security_group_ids = [
 +
        aws_security_group.node_group_one.id
 +
      ]
 +
    }
 +
 +
    two = {
 +
      name = "node-group-2"
 +
 +
      instance_types = ["t3.medium"]
 +
 +
      min_size    = 1
 +
      max_size    = 2
 +
      desired_size = 1
 +
 +
      pre_bootstrap_user_data = <<-EOT
 +
      echo 'foo bar'
 +
      EOT
 +
 +
      vpc_security_group_ids = [
 +
        aws_security_group.node_group_two.id
 +
      ]
 +
    }
 +
  }
 +
}
 +
</pre>
  
  

Revision as of 20:48, 25 September 2022

module "eks" {
  source  = "terraform-aws-modules/eks/aws"
  version = "18.26.6"

  cluster_name    = local.cluster_name
  cluster_version = "1.22"

  vpc_id     = module.vpc.vpc_id
  subnet_ids = module.vpc.private_subnets

  eks_managed_node_group_defaults = {
    ami_type = "AL2_x86_64"

    attach_cluster_primary_security_group = true

    # Disabling and using externally provided security groups
    create_security_group = false
  }

  eks_managed_node_groups = {
    one = {
      name = "node-group-1"

      instance_types = ["t3.small"]

      min_size     = 1
      max_size     = 3
      desired_size = 2

      pre_bootstrap_user_data = <<-EOT
      echo 'foo bar'
      EOT

      vpc_security_group_ids = [
        aws_security_group.node_group_one.id
      ]
    }

    two = {
      name = "node-group-2"

      instance_types = ["t3.medium"]

      min_size     = 1
      max_size     = 2
      desired_size = 1

      pre_bootstrap_user_data = <<-EOT
      echo 'foo bar'
      EOT

      vpc_security_group_ids = [
        aws_security_group.node_group_two.id
      ]
    }
  }
}


See also

Advertising: