From 8dff302284e5b45437ec1deab6fc60b51bd569db Mon Sep 17 00:00:00 2001 From: xorxsan <36991286+xorxsan@users.noreply.github.com> Date: Mon, 7 Nov 2022 18:45:25 +0100 Subject: [PATCH] Pass extra configuration to launch template userdata (#11) --- data/userdata.tpl | 2 ++ launch-template.tf | 9 +++++---- variables.tf | 6 ++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/data/userdata.tpl b/data/userdata.tpl index 87206bc..10875ef 100644 --- a/data/userdata.tpl +++ b/data/userdata.tpl @@ -18,4 +18,6 @@ set -ex ${bootstrap_extra_args} \ '${cluster_name}' +${launch_template_custom_userdata} + --//-- \ No newline at end of file diff --git a/launch-template.tf b/launch-template.tf index 400435b..86e982f 100644 --- a/launch-template.tf +++ b/launch-template.tf @@ -76,9 +76,10 @@ resource "aws_launch_template" "worker_nodes" { } user_data = base64encode(templatefile("${path.module}/data/userdata.tpl", { - cluster_name = var.cluster_name - cluster_endpoint = data.aws_eks_cluster.cluster.endpoint - certificate_authority_data = data.aws_eks_cluster.cluster.certificate_authority[0].data - bootstrap_extra_args = local.bootstrap_extra_args + cluster_name = var.cluster_name + cluster_endpoint = data.aws_eks_cluster.cluster.endpoint + certificate_authority_data = data.aws_eks_cluster.cluster.certificate_authority[0].data + bootstrap_extra_args = local.bootstrap_extra_args + launch_template_custom_userdata = var.launch_template_custom_userdata })) } diff --git a/variables.tf b/variables.tf index 6dc2aba..6b12d5b 100644 --- a/variables.tf +++ b/variables.tf @@ -91,3 +91,9 @@ variable "volume_type" { type = string default = "gp3" } + +variable "launch_template_custom_userdata" { + type = string + description = "Extra configuration executed after bootstraping the node" + default = "" +}