Skip to content

fix: forward the plugin options blob for all project types#189

Open
liamcervante wants to merge 1 commit into
mainfrom
fix/forward-plugin-blob-all-types
Open

fix: forward the plugin options blob for all project types#189
liamcervante wants to merge 1 commit into
mainfrom
fix/forward-plugin-blob-all-types

Conversation

@liamcervante

Copy link
Copy Markdown
Collaborator

What

buildIaCOptions only returned the persisted plugins.<name> blob for Terraform-family and CloudFormation projects; every other project type (Kubernetes, ...) fell through the default case and got a nil blob. As a result, per-environment parse options never reached those plugins.

This surfaced with the new Helm support in the Kubernetes parser: Helm environments all share Path: "." and differ only by their raw_options (the selected values-<env>.yaml files), so every environment collapsed to the base values.yaml render — dev and prod came out identical. (Kustomize was unaffected because its environments differ by Path, e.g. overlays/dev vs overlays/prod, which the scanner already forwards.)

Change

  • Removed buildIaCOptions. The plugin blob is now always forwarded via pluginBlobJSON(opts.Project, string(projectType)), keyed by the project type, so every plugin receives its persisted parse options.
  • Moved Env and RequiredAttributes into buildGenericOptions, set unconditionally. These are generic options by definition — any plugin that cares reads them, the rest ignore them — so they should not be gated behind a project-type switch. They are never duplicated into the opaque blob.

This mirrors the shape in infracost/lsp#58.

Testing

Ran infracost inspect against a multi-environment Helm chart: main-dev (ClusterIP, no backups, 1 replica) now correctly renders 3 resources / $12 while main-prod (LoadBalancer, io2 backups, 3 replicas) renders 6 resources / $216, instead of both collapsing to an identical base render.

buildIaCOptions only returned the persisted plugins.<name> blob for
Terraform-family and CloudFormation projects; every other type
(Kubernetes, ...) received a nil blob, so per-environment parse options
never reached the plugin. For Helm charts - whose environments share
Path "." and differ only by raw_options (their selected values files) -
this collapsed every environment to the base values.yaml render.

Always forward the blob via pluginBlobJSON keyed by the project type, and
set the caller-sourced generic options (Env, RequiredAttributes) in
buildGenericOptions unconditionally: they are generic options, so any
plugin that cares reads them and the rest ignore them. Removes the
type-switch in buildIaCOptions entirely.
@liamcervante
liamcervante requested a review from a team July 17, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant