Skip to content

Commit

Permalink
Pass extra configuration to launch template userdata (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
xorxsan authored Nov 7, 2022
1 parent dabffcc commit 8dff302
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions data/userdata.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ set -ex
${bootstrap_extra_args} \
'${cluster_name}'

${launch_template_custom_userdata}

--//--
9 changes: 5 additions & 4 deletions launch-template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}))
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
}

0 comments on commit 8dff302

Please sign in to comment.