Skip to content

Commit

Permalink
fix unexpected end of JSON input during planning
Browse files Browse the repository at this point in the history
github.com/kbst/terraform-provider-kustomize/kustomize.kustomizationResourceDiff: github.com/kbst/terraform-provider-kustomize/kustomize.(*kManifest).load: json error: unexpected end of JSON input
  • Loading branch information
nazarewk committed Jan 27, 2023
1 parent 1957b1e commit 3ca524d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kustomize/resource_kustomization.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,14 @@ func kustomizationResourceDiff(ctx context.Context, d *schema.ResourceDiff, m in

do, dm := d.GetChange("manifest")

if dm.(string) == "" {
return nil
}

kmm := newKManifest(mapper, client)
err := kmm.load([]byte(dm.(string)))
if err != nil {
return logError(err)
return logError(fmt.Errorf("failed to parse new manifest: %s [body=%#v]", err, do.(string)))
}
setLastAppliedConfig(kmm, gzipLastAppliedConfig)

Expand Down Expand Up @@ -239,7 +243,7 @@ func kustomizationResourceDiff(ctx context.Context, d *schema.ResourceDiff, m in
kmo := newKManifest(mapper, client)
err = kmo.load([]byte(do.(string)))
if err != nil {
return logError(err)
return logError(fmt.Errorf("failed to parse old manifest: %s [body=%#v]", err, do.(string)))
}
setLastAppliedConfig(kmo, gzipLastAppliedConfig)

Expand Down

0 comments on commit 3ca524d

Please sign in to comment.