mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-01-16 00:34:31 +01:00
* Configurable local exec command for waiting until cluster is healthy * readme * line feeds * format * fix readme * fix readme * Configurable local exec command for waiting until cluster is healthy (#1) * Configurable local exec command for waiting until cluster is healthy * readme * line feeds * format * fix readme * fix readme * change log * Configurable local exec wait 4 cluster op (#2) * Configurable local exec command for waiting until cluster is healthy * readme * line feeds * format * fix readme * fix readme * change log * changelog (#3) * Changelog (#4) * changelog * changelog * simplify wait_for_cluster command * readme * no op for manage auth false * formatting * docs? not sure * linter * specify dependency to wait for cluster more accurately
71 lines
2.2 KiB
HCL
71 lines
2.2 KiB
HCL
data "aws_caller_identity" "current" {
|
|
}
|
|
|
|
data "template_file" "launch_template_worker_role_arns" {
|
|
count = var.create_eks ? local.worker_group_launch_template_count : 0
|
|
template = file("${path.module}/templates/worker-role.tpl")
|
|
|
|
vars = {
|
|
worker_role_arn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${element(
|
|
coalescelist(
|
|
aws_iam_instance_profile.workers_launch_template.*.role,
|
|
data.aws_iam_instance_profile.custom_worker_group_launch_template_iam_instance_profile.*.role_name,
|
|
),
|
|
count.index,
|
|
)}"
|
|
platform = lookup(
|
|
var.worker_groups_launch_template[count.index],
|
|
"platform",
|
|
local.workers_group_defaults["platform"]
|
|
)
|
|
}
|
|
}
|
|
|
|
data "template_file" "worker_role_arns" {
|
|
count = var.create_eks ? local.worker_group_count : 0
|
|
template = file("${path.module}/templates/worker-role.tpl")
|
|
|
|
vars = {
|
|
worker_role_arn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${element(
|
|
coalescelist(
|
|
aws_iam_instance_profile.workers.*.role,
|
|
data.aws_iam_instance_profile.custom_worker_group_iam_instance_profile.*.role_name,
|
|
[""]
|
|
),
|
|
count.index,
|
|
)}"
|
|
platform = lookup(
|
|
var.worker_groups[count.index],
|
|
"platform",
|
|
local.workers_group_defaults["platform"]
|
|
)
|
|
}
|
|
}
|
|
|
|
data "template_file" "node_group_arns" {
|
|
count = var.create_eks ? length(module.node_groups.aws_auth_roles) : 0
|
|
template = file("${path.module}/templates/worker-role.tpl")
|
|
|
|
vars = module.node_groups.aws_auth_roles[count.index]
|
|
}
|
|
|
|
resource "kubernetes_config_map" "aws_auth" {
|
|
count = var.create_eks && var.manage_aws_auth ? 1 : 0
|
|
depends_on = [null_resource.wait_for_cluster[0]]
|
|
|
|
metadata {
|
|
name = "aws-auth"
|
|
namespace = "kube-system"
|
|
}
|
|
|
|
data = {
|
|
mapRoles = <<EOF
|
|
${join("", distinct(concat(data.template_file.launch_template_worker_role_arns.*.rendered, data.template_file.worker_role_arns.*.rendered, data.template_file.node_group_arns.*.rendered
|
|
)))}
|
|
%{if length(var.map_roles) != 0}${yamlencode(var.map_roles)}%{endif}
|
|
EOF
|
|
mapUsers = yamlencode(var.map_users)
|
|
mapAccounts = yamlencode(var.map_accounts)
|
|
}
|
|
}
|