Skip to content

Commit 8175533

Browse files
committed
added support for specifying user data for the worker launch config that runs before anything else
1 parent c5b637a commit 8175533

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

data.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ data template_file userdata {
7373
endpoint = "${aws_eks_cluster.this.endpoint}"
7474
cluster_auth_base64 = "${aws_eks_cluster.this.certificate_authority.0.data}"
7575
max_pod_count = "${lookup(local.max_pod_per_node, lookup(var.worker_groups[count.index], "instance_type", lookup(var.workers_group_defaults, "instance_type")))}"
76+
pre_userdata = "${lookup(var.worker_groups[count.index], "pre_userdata",lookup(var.workers_group_defaults, "pre_userdata"))}"
7677
additional_userdata = "${lookup(var.worker_groups[count.index], "additional_userdata",lookup(var.workers_group_defaults, "additional_userdata"))}"
7778
}
7879
}

templates/userdata.sh.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash -xe
22

3+
# Allow user supplied pre userdata code
4+
${pre_userdata}
5+
36
# Certificate Authority config
47
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki
58
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt

variables.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ variable "workers_group_defaults" {
5757
asg_min_size = "1" # Minimum worker capacity in the autoscaling group.
5858
instance_type = "m4.large" # Size of the workers instances.
5959
key_name = "" # The key name that should be used for the instances in the autoscaling group
60+
pre_userdata = "" # userdata to pre-append to the default userdata.
6061
additional_userdata = "" # userdata to append to the default userdata.
6162
ebs_optimized = true # sets whether to use ebs optimization on supported types.
6263
public_ip = false # Associate a public ip address with a worker

0 commit comments

Comments
 (0)