Skip to content

Commit

Permalink
for_each refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Jan 14, 2025
1 parent 0167dd2 commit 34b5751
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions eks_console_access.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ locals {

# Fetch the YAML files from the specified URLs
data "http" "cluster_roles" {
for_each = local.cluster_roles_map
for_each = { for cr in local.cluster_roles : cr.name => cr if cr.enabled }
url = each.value.url
}

Expand All @@ -46,10 +46,11 @@ data "http" "cluster_roles" {

# # Apply the Kubernetes manifests to the cluster
resource "kubernetes_manifest" "deploy_cluster_roles" {
for_each = { for manifest in provider::kubernetes::manifest_decode_multi(data.http.cluster_roles[each.key].body) : "${lower(manifest.kind)}-${manifest.metadata.name}-${manifest.metadata.namespace}" => manifest }
for_each = { for doc in local.cluster_roles_map : provider::kubernetes::manifest_decode_multi(doc) => manifest }
manifest = each.value
# manifest = [split("---\n", data.http.cluster_roles[each.key].body)]
}
# for_each = { for manifest in provider::kubernetes::manifest_decode_multi(data.http.cluster_roles[].body) : "${lower(manifest.kind)}-${manifest.metadata.name}-${manifest.metadata.namespace}" => manifest }
# manifest = [split("---\n", data.http.cluster_roles[each.key].body)]

# resource "null_resource" "apply_cluster_roles" {
# for_each = { for k, v in local.cluster_roles_map : k => v if v.enabled }
Expand Down

0 comments on commit 34b5751

Please sign in to comment.