fix: forward the plugin options blob for all project types#189
Open
liamcervante wants to merge 1 commit into
Open
fix: forward the plugin options blob for all project types#189liamcervante wants to merge 1 commit into
liamcervante wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
buildIaCOptionsonly returned the persistedplugins.<name>blob for Terraform-family and CloudFormation projects; every other project type (Kubernetes, ...) fell through thedefaultcase and got anilblob. 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 theirraw_options(the selectedvalues-<env>.yamlfiles), so every environment collapsed to the basevalues.yamlrender —devandprodcame out identical. (Kustomize was unaffected because its environments differ byPath, e.g.overlays/devvsoverlays/prod, which the scanner already forwards.)Change
buildIaCOptions. The plugin blob is now always forwarded viapluginBlobJSON(opts.Project, string(projectType)), keyed by the project type, so every plugin receives its persisted parse options.EnvandRequiredAttributesintobuildGenericOptions, 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 inspectagainst a multi-environment Helm chart:main-dev(ClusterIP, no backups, 1 replica) now correctly renders 3 resources / $12 whilemain-prod(LoadBalancer, io2 backups, 3 replicas) renders 6 resources / $216, instead of both collapsing to an identical base render.