Skip to content

Commit cd7e56c

Browse files
Matthew Cayamax-rocket-internet
authored andcommitted
Fixed issue with 'workers_group_defaults_defaults.iam_role_id' and added explicit depends_on for 'update_config_map_aws_auth' (#147)
* fix worker default 'iam_role_id' dependency * Add explicit depends_on to eks cluster for 'update_config_map_aws_auth'
1 parent 0ee9d63 commit cd7e56c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

aws_auth.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ resource "local_file" "config_map_aws_auth" {
55
}
66

77
resource "null_resource" "update_config_map_aws_auth" {
8+
depends_on = ["aws_eks_cluster.this"]
9+
810
provisioner "local-exec" {
911
command = "kubectl apply -f ${var.config_output_path}config-map-aws-auth_${var.cluster_name}.yaml --kubeconfig ${var.config_output_path}kubeconfig_${var.cluster_name}"
1012
}

local.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ locals {
66
cluster_security_group_id = "${coalesce(join("", aws_security_group.cluster.*.id), var.cluster_security_group_id)}"
77

88
worker_security_group_id = "${coalesce(join("", aws_security_group.workers.*.id), var.worker_security_group_id)}"
9+
default_iam_role_id = "${element(concat(aws_iam_role.workers.*.id, list("")), 0)}"
910
kubeconfig_name = "${var.kubeconfig_name == "" ? "eks_${var.cluster_name}" : var.kubeconfig_name}"
1011

1112
workers_group_defaults_defaults = {
@@ -30,7 +31,7 @@ locals {
3031
autoscaling_enabled = false # Sets whether policy and matching tags will be added to allow autoscaling.
3132
additional_security_group_ids = "" # A comman delimited list of additional security group ids to include in worker launch config
3233
protect_from_scale_in = false # Prevent AWS from scaling in, so that cluster-autoscaler is solely responsible.
33-
iam_role_id = "${aws_iam_role.workers.id}" # Use the specified IAM role if set.
34+
iam_role_id = "${local.default_iam_role_id}" # Use the specified IAM role if set.
3435
}
3536

3637
workers_group_defaults = "${merge(local.workers_group_defaults_defaults, var.workers_group_defaults)}"

0 commit comments

Comments
 (0)