1
0
mirror of https://github.com/terraform-aws-modules/terraform-aws-eks.git synced 2025-09-09 19:32:58 +08:00

Fix errors manifesting when used on an existing-cluster

This commit is contained in:
syst0m
2019-11-07 17:52:25 +00:00
parent a3009b1ecc
commit 880fd427a4
5 changed files with 10 additions and 7 deletions
+4 -3
View File
@@ -1,6 +1,6 @@
resource "local_file" "config_map_aws_auth" {
count = var.write_aws_auth_config && var.enabled ? 1 : 0
content = data.template_file.config_map_aws_auth.rendered
content = data.template_file.config_map_aws_auth[0].rendered
filename = "${var.config_output_path}config-map-aws-auth_${var.cluster_name}.yaml"
}
@@ -26,8 +26,8 @@ EOS
}
triggers = {
kube_config_map_rendered = data.template_file.kubeconfig.rendered
config_map_rendered = data.template_file.config_map_aws_auth.rendered
kube_config_map_rendered = data.template_file.kubeconfig[0].rendered
config_map_rendered = data.template_file.config_map_aws_auth[0].rendered
endpoint = aws_eks_cluster.this[count.index].endpoint
}
}
@@ -77,6 +77,7 @@ data "template_file" "worker_role_arns" {
}
data "template_file" "config_map_aws_auth" {
count = var.enabled ? 1 : 0
template = file("${path.module}/templates/config-map-aws-auth.yaml.tpl")
vars = {
+1
View File
@@ -63,6 +63,7 @@ data "aws_iam_policy_document" "cluster_assume_role_policy" {
}
data "template_file" "kubeconfig" {
count = var.enabled ? 1 : 0
template = file("${path.module}/templates/kubeconfig.tpl")
vars = {
+1 -1
View File
@@ -1,5 +1,5 @@
resource "local_file" "kubeconfig" {
count = var.write_kubeconfig && var.enabled ? 1 : 0
content = data.template_file.kubeconfig.rendered
content = data.template_file.kubeconfig[0].rendered
filename = "${substr(var.config_output_path, -1, 1) == "/" ? "${var.config_output_path}kubeconfig_${var.cluster_name}" : var.config_output_path}"
}
+2 -2
View File
@@ -30,7 +30,7 @@ output "cluster_security_group_id" {
output "config_map_aws_auth" {
description = "A kubernetes configuration to authenticate to this EKS cluster."
value = data.template_file.config_map_aws_auth.rendered
value = concat(data.template_file.config_map_aws_auth[*].rendered, [""])[0]
}
output "cluster_iam_role_name" {
@@ -55,7 +55,7 @@ output "cloudwatch_log_group_name" {
output "kubeconfig" {
description = "kubectl config file contents for this EKS cluster."
value = data.template_file.kubeconfig.rendered
value = concat(data.template_file.kubeconfig[*].rendered, [""])[0]
}
output "kubeconfig_filename" {
+2 -1
View File
@@ -368,11 +368,12 @@ resource "aws_iam_policy" "worker_autoscaling" {
count = var.manage_worker_iam_resources && var.manage_worker_autoscaling_policy && var.enabled ? 1 : 0
name_prefix = "eks-worker-autoscaling-${aws_eks_cluster.this[count.index].name}"
description = "EKS worker node autoscaling policy for cluster ${aws_eks_cluster.this[count.index].name}"
policy = data.aws_iam_policy_document.worker_autoscaling.json
policy = data.aws_iam_policy_document.worker_autoscaling[0].json
path = var.iam_path
}
data "aws_iam_policy_document" "worker_autoscaling" {
count = var.manage_worker_iam_resources && var.manage_worker_autoscaling_policy && var.enabled ? 1 : 0
statement {
sid = "eksWorkerAutoscalingAll"
effect = "Allow"