Skip to content

Commit d2eb2a3

Browse files
Merge pull request #43 from bti360/pre-userdata-script-on-worker-nodes
added support for specifying user data for the worker launch config t…
2 parents c5b637a + 9f78162 commit d2eb2a3

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this
66
project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [[v1.3.0]()] - ]
9+
10+
### Added
11+
12+
- new variable `pre_userdata` added to worker launch configuration allows to run scripts before the plugin does anything.
13+
814
## [[v1.1.0](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v1.0.0...v1.1.0)] - 2018-06-25]
915

1016
### Added

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)