Worker node number and instance type cannot be configured.
Configuration options for worker node number and instance type can be specified in module inputs.
Hey @Jeeppler -
I want to get a sense of what you mean by worker node number exactly. If you're meaning the name of the workers themselves, that's configurable through the list of maps passed to the module. Likewise, for each worker group, desired capacity, max capacity, and min capacity of each autoscaling group is controlled through the same mechanism: https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/variables.tf#L53-L57
Maybe I'm missing what you're after here. If so, can you explain a little more? Thanks for taking interest in the project and hopefully we can get these use cases clarified for module consumers like you. 🌟
@brandoconnor that make sense. However, I don't really understand how to use the "workers_group_defaults" map. Maybe providing an example would be nice. Have a look at the vpc module it includes an example section.
I tried this:
workers_group_defaults = {
key_name = "eks-worker"
instance_type = "m5.large"
asg_desired_capacity = 2
}
and got the following error message while running the terraform plan command:
$ terraform plan -out=plan
Error: module.eks.data.template_file.userdata: 1 error(s) occurred:
* module.eks.data.template_file.userdata: lookup: lookup failed to find 'additional_userdata' in:
${lookup(var.worker_groups[count.index], "additional_userdata",lookup(var.workers_group_defaults, "additional_userdata"))}
The solution for my above problem was to simply copy and paste the default values and set my own values for the values I want to change.
~
workers_group_defaults = {
name = "count.index" # Name of the worker group. Literal count.index will never be used but if name is not set, the count.index interpolation will be used.
ami_id = "" # AMI ID for the eks workers. If none is provided, Terraform will search for the latest version of their EKS optimized worker AMI.
asg_desired_capacity = "2" # Desired worker capacity in the autoscaling group.
asg_max_size = "3" # Maximum worker capacity in the autoscaling group.
asg_min_size = "1" # Minimum worker capacity in the autoscaling group.
instance_type = "m5.large" # Size of the workers instances.
key_name = "eks-worker" # The key name that should be used for the instances in the autoscaling group
additional_userdata = "" # userdata to append to the default userdata.
ebs_optimized = true # sets whether to use ebs optimization on supported types.
public_ip = false # Associate a public ip address with a worker
}
~
Thanks for that @Jeppler. I should have made an example showing how to
leverage the pattern like this.
Im out of town for a couple days here but should be able to cut a release
toward the end of the week. Look for an example in the next realease.
On Tue, Jun 19, 2018 at 15:45 Jeppler notifications@github.com wrote:
The solution for my above problem was to simply copy and paste the default
values and set my own.workers_group_defaults = { name = "count.index" # Name of the worker group. Literal count.index will never be used but if name is not set, the count.index interpolation will be used. ami_id = "" # AMI ID for the eks workers. If none is provided, Terraform will search for the latest version of their EKS optimized worker AMI. asg_desired_capacity = "2" # Desired worker capacity in the autoscaling group. asg_max_size = "3" # Maximum worker capacity in the autoscaling group. asg_min_size = "1" # Minimum worker capacity in the autoscaling group. instance_type = "m5.large" # Size of the workers instances. key_name = "eks-worker" # The key name that should be used for the instances in the autoscaling group additional_userdata = "" # userdata to append to the default userdata. ebs_optimized = true # sets whether to use ebs optimization on supported types. public_ip = false # Associate a public ip address with a worker }—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/terraform-aws-modules/terraform-aws-eks/issues/20#issuecomment-398569636,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACYveISAiwbykuISfJ1w4jNh-DuYzY1eks5t-X8LgaJpZM4UqSBH
.
Here's an example that uses some static values as well as a variable that you can configure in your tfvars that will create an AutoScalingGroup with a desired/miniumum of 2 worker nodes, and allows the cluster to scale up to 10:
locals {
worker_groups = "${list(
map("asg_desired_capacity", "2",
"asg_max_size", "10",
"asg_min_size", "2",
"instance_type", "${var.worker_instance_type}",
"name", "worker",
),
)}"
Thanks for that @fdornberger . I've added a commented out example resembling this to the example main.tf.
@brandoconnor you're very welcome.