mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-15 08:14:12 +01:00
* Finished first cut of managed node groups * Updated formatting and extra fields. * Updating Changelog and README * Fixing formatting * Fixing docs. * Updating required Version * Updating changelog * Adding example for managed node groups * Managed IAM Roles for Nodegroups now have correct policies. Tags can now be added to node groups. * Fixing bug where people could set source_security_group_ids without setting ssh key causing a race condition within the aws provider. * Adding lifecycle create_before_destroy * Adding random pet names for create_before_destroy * Updating per comments. * Updating required versions of terraform * Updating per comments. * Updating vars * Updating minimum version for terraform * Change worker_groups_managed_node_groups to node_groups * Using for_each on the random_pet * Adding changes recommended by @eytanhanig * Update node_groups.tf
105 lines
2.2 KiB
HCL
105 lines
2.2 KiB
HCL
terraform {
|
|
required_version = ">= 0.12.6"
|
|
}
|
|
|
|
provider "aws" {
|
|
version = ">= 2.28.1"
|
|
region = var.region
|
|
}
|
|
|
|
provider "random" {
|
|
version = "~> 2.1"
|
|
}
|
|
|
|
provider "local" {
|
|
version = "~> 1.2"
|
|
}
|
|
|
|
provider "null" {
|
|
version = "~> 2.1"
|
|
}
|
|
|
|
provider "template" {
|
|
version = "~> 2.1"
|
|
}
|
|
|
|
data "aws_availability_zones" "available" {
|
|
}
|
|
|
|
locals {
|
|
cluster_name = "test-eks-${random_string.suffix.result}"
|
|
}
|
|
|
|
resource "random_string" "suffix" {
|
|
length = 8
|
|
special = false
|
|
}
|
|
|
|
module "vpc" {
|
|
source = "terraform-aws-modules/vpc/aws"
|
|
version = "~> 2.6"
|
|
|
|
name = "test-vpc"
|
|
cidr = "172.16.0.0/16"
|
|
azs = data.aws_availability_zones.available.names
|
|
private_subnets = ["172.16.1.0/24", "172.16.2.0/24", "172.16.3.0/24"]
|
|
public_subnets = ["172.16.4.0/24", "172.16.5.0/24", "172.16.6.0/24"]
|
|
enable_nat_gateway = true
|
|
single_nat_gateway = true
|
|
enable_dns_hostnames = true
|
|
|
|
tags = {
|
|
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
|
|
}
|
|
|
|
public_subnet_tags = {
|
|
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
|
|
"kubernetes.io/role/elb" = "1"
|
|
}
|
|
|
|
private_subnet_tags = {
|
|
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
|
|
"kubernetes.io/role/internal-elb" = "1"
|
|
}
|
|
}
|
|
|
|
module "eks" {
|
|
source = "../.."
|
|
cluster_name = local.cluster_name
|
|
subnets = module.vpc.private_subnets
|
|
|
|
tags = {
|
|
Environment = "test"
|
|
GithubRepo = "terraform-aws-eks"
|
|
GithubOrg = "terraform-aws-modules"
|
|
}
|
|
|
|
vpc_id = module.vpc.vpc_id
|
|
|
|
node_groups = [
|
|
{
|
|
name = "example"
|
|
|
|
node_group_desired_capacity = 1
|
|
node_group_max_capacity = 10
|
|
node_group_min_capacity = 1
|
|
|
|
instance_type = "m5.large"
|
|
node_group_k8s_labels = {
|
|
Environment = "test"
|
|
GithubRepo = "terraform-aws-eks"
|
|
GithubOrg = "terraform-aws-modules"
|
|
}
|
|
node_group_additional_tags = {
|
|
Environment = "test"
|
|
GithubRepo = "terraform-aws-eks"
|
|
GithubOrg = "terraform-aws-modules"
|
|
}
|
|
}
|
|
]
|
|
|
|
map_roles = var.map_roles
|
|
map_users = var.map_users
|
|
map_accounts = var.map_accounts
|
|
}
|