Skip to content

Commit

Permalink
try provider function
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Jan 14, 2025
1 parent ebfacf7 commit 466c10d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ sys 0m2.015s
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.14.0 |
| <a name="requirement_http"></a> [http](#requirement\_http) | >= 2.1.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.23.0 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 1.0 |

## Providers

Expand All @@ -44,7 +43,6 @@ sys 0m2.015s
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.83.1 |
| <a name="provider_http"></a> [http](#provider\_http) | 3.4.5 |
| <a name="provider_kubernetes"></a> [kubernetes](#provider\_kubernetes) | 2.35.1 |
| <a name="provider_null"></a> [null](#provider\_null) | >= 1.0 |

## Modules

Expand All @@ -61,7 +59,6 @@ sys 0m2.015s
| [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.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 |
| [http_http.cluster_roles](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | data source |
Expand Down
23 changes: 13 additions & 10 deletions eks_console_access.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,24 @@ data "http" "cluster_roles" {
url = each.value.url
}

resource "null_resource" "cluster_roles" {
for_each = local.cluster_roles_map
triggers = {
roles = join(",", [each.key, each.value.url])
}
provisioner "local-exec" {
command = "echo '${data.http.cluster_roles[each.key].body}' > ${each.value.name}.yaml"
}
}
# resource "null_resource" "cluster_roles" {
# for_each = local.cluster_roles_map
# triggers = {
# roles = join(",", [each.key, each.value.url])
# }
# provisioner "local-exec" {
# command = "echo '${data.http.cluster_roles[each.key].body}' > ${each.value.name}.yaml"
# }
# }

# # Apply the Kubernetes manifests to the cluster
resource "kubernetes_manifest" "deploy_cluster_roles" {
# depends_on = [null_resource.cluster_roles]
for_each = { for k, v in local.cluster_roles_map : k => v if v.enabled }
manifest = [split("---", yamldecode(data.http.cluster_roles[each.key].body))]
triggers = {
roles = join(",", [each.key, each.value.url])
}
manifest = manifest_decode(data.http.cluster_roles[each.key].body)
}

# resource "null_resource" "apply_cluster_roles" {
Expand Down
4 changes: 0 additions & 4 deletions requirements.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,5 @@ terraform {
source = "hashicorp/kubernetes"
version = ">= 2.23.0"
}
null = {
source = "hashicorp/null"
version = ">= 1.0"
}
}
}

0 comments on commit 466c10d

Please sign in to comment.