Skip to content

Commit

Permalink
Update main.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshitSF authored Jan 31, 2025
1 parent 43467c8 commit 2c05b5b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/eks-auth/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ resource "kubernetes_config_map_v1_data" "aws_auth" {
# Convert to list, make distinct to remove duplicates, and convert to YAML as mapRoles is a YAML string.
# Replace() removes double quotes on "strings" in YAML output.
# Distinct() only applies the change once, not append every run.
mapRoles = replace(yamlencode(distinct(concat(yamldecode(data.kubernetes_config_map.aws_auth.data.mapRoles), yamldecode(local.new_role_yaml)))), "\"", "")
mapRoles = length(local.new_role_yaml) > 0 ? replace(yamlencode(distinct(concat(yamldecode(data.kubernetes_config_map.aws_auth.data.mapRoles), yamldecode(local.new_role_yaml)))), "\"", "")
#mapUsers = replace(yamlencode(distinct(concat(yamldecode(data.kubernetes_config_map.aws_auth.data.mapUsers), yamldecode(local.new_user_yaml)))), "\"", "")
mapAccounts = length(local.new_account_yaml) > 0 ? replace(yamlencode(distinct(concat(yamldecode(coalesce(data.kubernetes_config_map.aws_auth.data.mapAccounts, "[]")), yamldecode(local.new_account_yaml)))), "\"", "") : ""
mapUsers = length(local.new_user_yaml) > 0 ? replace(yamlencode(distinct(concat(yamldecode(coalesce(data.kubernetes_config_map.aws_auth.data.mapUsers, "[]")), yamldecode(local.new_user_yaml)))), "\"", "") : ""
Expand All @@ -52,4 +52,4 @@ resource "kubernetes_config_map_v1_data" "aws_auth" {
ignore_changes = []
prevent_destroy = true
}
}
}

0 comments on commit 2c05b5b

Please sign in to comment.