-
Notifications
You must be signed in to change notification settings - Fork 53
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
json error during kustomizationResourceDiff #219
Comments
I need a config to reproduce the issue to look into it. |
Sure, I'll see if I can slim down our current config to a reproducible case. |
Also getting blocked by this error, I've narrowed it down to empty terraform-provider-kustomization/kustomize/resource_kustomization.go Lines 185 to 191 in 1957b1e
|
not sure if it's way to go, have no time to dig into the root cause, but code changes in my PR fixed the issue without breaking anything (getting plan as expected) |
I haven't narrowed this done to a smaller case ATM, been OOO for bereavement. However, I did discover by accident that when I tried to run a terraform plan several days later it worked. Makes me think there is some type of caching being done and after a while the cache expires and a full set of data for the diff is sent. |
@nazarewk what we would need to figure out is if modified being empty is an expected state in Terraform or if there is some error causing this. If there is an error that causes modified to be empty, either in the manifests themselves or somewhere else along the way, just returning nil on the diff seems like a dangerous approach. |
I am quite sure it is caused by Note I'm having a little exotic workflow:
codemodule "prerender" {
source = "../../../modules/k8s/kustomization-overlay"
# can prerender, because patches won't change set of resource identifiers
resources = [
"${path.module}/k8s",
]
}
module "source" {
source = "../../../modules/k8s/kustomization-overlay"
resources = [
"${path.module}/k8s",
]
patches = concat(values(module.irsa.kustomize_patches), [
{
target : { "kind" : "ClusterIssuer" },
patch : jsonencode([
{
op = "add"
path = "/spec/acme/solvers"
value = [
# see https://cert-manager.io/docs/configuration/acme/dns01/route53/#creating-an-issuer-or-clusterissuer
{
selector = { dnsZones = [for zone_id, zone in data.aws_route53_zone.these : zone.name] }
dns01 = { route53 = {
region = var.aws_region
} }
}
]
}
])
}
])
}
module "kustomization-apply" {
source = "../../../modules/k8s/kustomization-apply"
ids_prio = module.prerender.ids_prio
manifests = module.source.manifests
} |
actually with my "fix" it did not update the values until the next run, so while it might be caused by |
I've also noticed that current version does not notice manual changes done to resources showing no diff at all. edit: looks like it was already reported at #94 |
If the change did not update the annotation yes, that's a known limitation of the provider. |
I can confirm with 90% certainty, that the error occurs when values are |
I am running into this same issue. Is there a workaround I can look at? |
not really, I used my locally built patch to work around it #221 |
A workaround is to do targeted applies to resources that the broken resource depends upon. |
I created a repo for reproducing this issue: https://github.com/pascal-hofmann/terraform-provider-kustomization-reproduction-219 Other terraform providers treat this case like this:
I'm not sure how to live with the missing validation in this case, but I also wonder if Edit: Seems like it is:
Source: https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema |
We have a terraform config like
The bar module, which installs fluxcd.io, does not use the any output of the foo module, it just has a dependency on 1 output to ensure that the foo module completes 1st. Now when the terraform config is 1st created all is well. And all subsequent plans are fine too, until I update the version # in the foo module to say 1.2.1. Then the terraform plan will always fails with errors like
This continues until I set the version in the foo module back to the original 1.2.0 and then the plans will successfully complete.
The text was updated successfully, but these errors were encountered: