-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
for_each on kubectl_path_documents errors with The "for_each" value depends on resource attributes that cannot be determined until apply #215
Comments
Also experiencing this on EDIT: Sorry, I tried again just now and it seems to be working fine.
|
I have same issue..
│ Error: Invalid count argument |
Same issue here. Terraform 1.3.4, but had this issue also on 1.1.x. count:
gives:
while for_each returns:
|
https://registry.terraform.io/providers/gavinbunney/kubectl/latest/docs/data-sources/kubectl_path_documents#load-all-manifest-documents-via-for_each-recommended
|
I ran into the same issue. This error seems common when you have 2 or more resources in a module. Create a new file in the module and move a resource over seems to fix it as well. lol The "for_each" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that |
What TF version are you using, I tried to split the files as you recommended, and I am still encountering this issue. |
I'm finding this issue too. It used to work for a while but now it doesn't :( |
@justinb-shipt , well, it used to work. One day it just broke. Even more strange, it broke just in some places but not in others. Anyway, I just dropped this provider and use other tools now. |
@bluebrown, I agree. I'm using it to manage the CRDs for our service mesh implementation and it's still working fine on ~20 other clusters and broke on 2. Very strange. I just wanted to reference the Hashicorp doc, since nobody else has, and possibly dig into the code. |
I made up a hacky solution that involves replacing this provider with the helm provider, which always works. You can just put a directory (i.e. myhelmchart) next you your terraform files with a filed "Chart.yaml" (google an example of it and copy it) and a directory called "templates" where you put your yaml files. Then using helm provider just point the "repository" to "${path.module}/myhelmchart/" Additionally, because my files were super templated (using terraform's templatefile) instead of helm templates, I opted to pass the yaml directly from terraform to helm. I don't love it but it was extremely quicker for now as I could switch from kubectl provider to helm instantly. To do this, I pass a variable with helm using:
And then I decode from helm by putting this into the templates/files.yaml
Hope it helps someone |
I managed to get this working by looping over
|
Given the lack of a comment from the maintainer, despite the high amount of users facing the problem. I think it's safe to say that this provider is not maintained anymore. |
On my side, I got this issue with a depends_on in my data "kubectl_file_documents" ... In my terraform project, I ve 2 different files with these documents/manifest... |
How did you run a |
I got:
and as a result:
|
I've created a local variable map of strings. Works fine for me. locals {
kube_event_exporter_manifests = {
configmap = <<-YAML
apiVersion: v1
kind: ConfigMap
metadata:
...
YAML
deployment = <<-YAML
apiVersion: apps/v1
kind: Deployment
metadata:
name: event-exporter
namespace: ${kubernetes_namespace.kube_event_exporter.metadata[0].name}
...
YAML
}
}
resource "kubectl_manifest" "kube_event_exporter" {
for_each = local.kube_event_exporter_manifests
yaml_body = each.value
} |
Official |
Hi, I figured out that using See:
This looks more like an internal terraform issue. Similar to #61 I opened an issue on terraform directly: hashicorp/terraform#34391 |
I've managed to implement the Hope it helps people here |
Hi, I am trying to use the provider but terraform errors:
I followed the exmple from the docs:
Its strange because I have this in a module and it only fails in 1 out of 2 places where the module is used.
The text was updated successfully, but these errors were encountered: