From 9760a7003faad673c92c9b46ece95b061e230e95 Mon Sep 17 00:00:00 2001 From: "Matthew C. Morgan" Date: Mon, 13 Jan 2025 17:17:48 -0500 Subject: [PATCH] use null to pull file --- README.md | 2 +- eks_console_access.tf | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 5c05be2..7eb2587 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,11 @@ sys 0m2.015s | Name | Type | |------|------| +| [kubernetes_manifest.deploy_cluster_roles](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/manifest) | resource | | [kubernetes_namespace.operators](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace) | resource | | [kubernetes_storage_class.ebs_encrypted](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource | | [kubernetes_storage_class.efs_sc](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource | | [kubernetes_storage_class.gp3_encrypted](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/storage_class) | resource | -| [null_resource.apply_cluster_roles](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [null_resource.cluster_roles](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | | [aws_ebs_default_kms_key.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ebs_default_kms_key) | data source | | [aws_kms_key.ebs_key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/kms_key) | data source | diff --git a/eks_console_access.tf b/eks_console_access.tf index 024a916..8f326f0 100644 --- a/eks_console_access.tf +++ b/eks_console_access.tf @@ -33,12 +33,6 @@ data "http" "cluster_roles" { url = each.value.url } -# # Apply the Kubernetes manifests to the cluster -# resource "kubernetes_manifest" "deploy_cluster_roles" { -# for_each = local.cluster_roles_map -# manifest = yamldecode(data.http.cluster_roles[each.key].body) -# } - resource "null_resource" "cluster_roles" { for_each = local.cluster_roles_map triggers = { @@ -49,12 +43,18 @@ resource "null_resource" "cluster_roles" { } } -resource "null_resource" "apply_cluster_roles" { +# # Apply the Kubernetes manifests to the cluster +resource "kubernetes_manifest" "deploy_cluster_roles" { for_each = { for k, v in local.cluster_roles_map : k => v if v.enabled } - triggers = { - roles = join(",", [each.key, each.value.url]) - } - provisioner "local-exec" { - command = "kubectl apply -f ${each.value.name}.yaml" - } + manifest = yamldecode(file("${each.value.name}.yaml")) } + +# resource "null_resource" "apply_cluster_roles" { +# for_each = { for k, v in local.cluster_roles_map : k => v if v.enabled } +# triggers = { +# roles = join(",", [each.key, each.value.url]) +# } +# provisioner "local-exec" { +# command = "kubectl apply -f ${each.value.name}.yaml" +# } +# }