mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-04-24 17:48:26 +02:00
added support for specifying user data for the worker launch config that runs before anything else
This commit is contained in:
1
data.tf
1
data.tf
@@ -73,6 +73,7 @@ data template_file userdata {
|
|||||||
endpoint = "${aws_eks_cluster.this.endpoint}"
|
endpoint = "${aws_eks_cluster.this.endpoint}"
|
||||||
cluster_auth_base64 = "${aws_eks_cluster.this.certificate_authority.0.data}"
|
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")))}"
|
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"))}"
|
additional_userdata = "${lookup(var.worker_groups[count.index], "additional_userdata",lookup(var.workers_group_defaults, "additional_userdata"))}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash -xe
|
#!/bin/bash -xe
|
||||||
|
|
||||||
|
# Allow user supplied pre userdata code
|
||||||
|
${pre_userdata}
|
||||||
|
|
||||||
# Certificate Authority config
|
# Certificate Authority config
|
||||||
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki
|
CA_CERTIFICATE_DIRECTORY=/etc/kubernetes/pki
|
||||||
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt
|
CA_CERTIFICATE_FILE_PATH=$CA_CERTIFICATE_DIRECTORY/ca.crt
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ variable "workers_group_defaults" {
|
|||||||
asg_min_size = "1" # Minimum worker capacity in the autoscaling group.
|
asg_min_size = "1" # Minimum worker capacity in the autoscaling group.
|
||||||
instance_type = "m4.large" # Size of the workers instances.
|
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
|
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.
|
additional_userdata = "" # userdata to append to the default userdata.
|
||||||
ebs_optimized = true # sets whether to use ebs optimization on supported types.
|
ebs_optimized = true # sets whether to use ebs optimization on supported types.
|
||||||
public_ip = false # Associate a public ip address with a worker
|
public_ip = false # Associate a public ip address with a worker
|
||||||
|
|||||||
Reference in New Issue
Block a user