Skip to content

Commit

Permalink
Merge pull request #33 from nalbam/workers
Browse files Browse the repository at this point in the history
add workers
  • Loading branch information
nalbam authored Jan 22, 2024
2 parents 3aaa7b9 + a384e5a commit 4e948e7
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 9 deletions.
25 changes: 17 additions & 8 deletions 00-variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ variable "addons_resolve_conflicts_on_update" {
variable "addons_configuration" {
type = map(string)
default = {
"coredns" : "{}"
"kube-proxy" : "{}"
"vpc-cni" : "{}"
# "coredns" : "{}"
# "kube-proxy" : "{}"
# "vpc-cni" : "{}"
}
}

Expand All @@ -159,11 +159,6 @@ variable "addons_irsa_role" {
}
}

variable "tags" {
type = map(string)
default = {}
}

variable "save_local_files" {
type = bool
default = false
Expand All @@ -178,3 +173,17 @@ variable "enable_event" {
type = bool
default = true
}

variable "tags" {
type = map(string)
default = {}
}

variable "workers" {
default = [
# {
# name = "workers"
# vername = "v1"
# },
]
}
File renamed without changes.
53 changes: 53 additions & 0 deletions 85-workers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# workers

module "workers" {
# source = "../terraform-aws-eks-worker"
source = "nalbam/eks-worker/aws"
version = "~> 3.0"

for_each = {
for w in var.workers :
format("%s-%s-%s", w.name, try(w.subname, ""), try(w.vername, "")) => w
}

name = each.value.name
subname = try(each.value.subname, "")
vername = try(each.value.vername, "")

region = var.region
account_id = var.account_id

cluster_name = var.cluster_name

cluster_endpoint = aws_eks_cluster.cluster.endpoint
cluster_certificate_authority = data.aws_eks_cluster.cluster.certificate_authority.0.data

ami_id = try(each.value.ami_id, data.aws_ami.worker.id)
role_name = aws_iam_role.worker.name
security_groups = [aws_security_group.worker.id]
subnet_ids = try(each.value.subnet_ids, var.subnet_ids)

kubernetes_version = var.kubernetes_version

key_name = try(each.value.key_name, null)

enable_autoscale = try(each.value.enable_autoscale, true)
enable_mixed = try(each.value.enable_mixed, true)
enable_taints = try(each.value.enable_taints, false)

on_demand_base = try(each.value.on_demand_base, 0)
on_demand_rate = try(each.value.on_demand_rate, 0)

mixed_instances = try(each.value.mixed_instances, ["t3.medium"])
volume_type = try(each.value.volume_type, "gp3")
volume_size = try(each.value.volume_size, "50")

min = try(each.value.min, 1)
max = try(each.value.max, 3)

tags = local.tags

depends_on = [
aws_eks_cluster.cluster,
]
}
File renamed without changes.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| account\_id | n/a | `string` | n/a | yes |
| addons\_configuration | n/a | `map(string)` | <pre>{<br> "coredns": "{}",<br> "kube-proxy": "{}",<br> "vpc-cni": "{}"<br>}</pre> | no |
| addons\_configuration | n/a | `map(string)` | `{}` | no |
| addons\_irsa\_role | n/a | `map(string)` | `{}` | no |
| addons\_resolve\_conflicts\_on\_create | n/a | `string` | `"OVERWRITE"` | no |
| addons\_resolve\_conflicts\_on\_update | n/a | `string` | `"PRESERVE"` | no |
Expand Down Expand Up @@ -58,6 +58,7 @@
| worker\_ports\_internal | n/a | `list(number)` | `[]` | no |
| worker\_ports\_public | n/a | `list(number)` | `[]` | no |
| worker\_source\_sgs | n/a | `list(string)` | `[]` | no |
| workers | n/a | `list` | `[]` | no |

## Outputs

Expand Down

0 comments on commit 4e948e7

Please sign in to comment.