diff --git a/CHANGELOG.md b/CHANGELOG.md index 5de07b7..7fdf29e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [[v1.3.0]()] - ] + +### Added + +- new variable `pre_userdata` added to worker launch configuration allows to run scripts before the plugin does anything. + ## [[v1.1.0](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v1.0.0...v1.1.0)] - 2018-06-25] ### Added diff --git a/data.tf b/data.tf index 271f961..9fe0727 100644 --- a/data.tf +++ b/data.tf @@ -73,6 +73,7 @@ data template_file userdata { endpoint = "${aws_eks_cluster.this.endpoint}" cluster_auth_base64 = "${aws_eks_cluster.this.certificate_authority.0.data}" max_pod_count = "${lookup(local.max_pod_per_node, lookup(var.worker_groups[count.index], "instance_type", lookup(var.workers_group_defaults, "instance_type")))}" + pre_userdata = "${lookup(var.worker_groups[count.index], "pre_userdata",lookup(var.workers_group_defaults, "pre_userdata"))}" additional_userdata = "${lookup(var.worker_groups[count.index], "additional_userdata",lookup(var.workers_group_defaults, "additional_userdata"))}" } } diff --git a/templates/userdata.sh.tpl b/templates/userdata.sh.tpl index a7cf09e..024652a 100644 --- a/templates/userdata.sh.tpl +++ b/templates/userdata.sh.tpl @@ -1,5 +1,8 @@ #!/bin/bash -xe +# Allow user supplied pre userdata code +${pre_userdata} + # Certificate Authority config CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt diff --git a/variables.tf b/variables.tf index 245211d..2a763e4 100644 --- a/variables.tf +++ b/variables.tf @@ -57,6 +57,7 @@ variable "workers_group_defaults" { asg_min_size = "1" # Minimum worker capacity in the autoscaling group. instance_type = "m4.large" # Size of the workers instances. key_name = "" # The key name that should be used for the instances in the autoscaling group + pre_userdata = "" # userdata to pre-append to the default userdata. 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