Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
783b58f to
47a1cb9
Compare
Greptile SummaryThis PR integrates infracost into the deployment operator's Terraform harness to produce per-resource cost estimates after
Confidence Score: 3/5The infracost feature will silently produce no cost data at runtime because the binary plan file is passed where a JSON plan or directory is required. The core execution path in pkg/harness/tool/terraform/infracost.go — specifically the
|
| Filename | Overview |
|---|---|
| pkg/harness/tool/terraform/infracost.go | New infracost integration; passes the binary terraform.tfplan file to infracost breakdown --path, which expects a JSON plan or a directory — this will consistently fail at runtime |
| pkg/harness/tool/terraform/infracost_types.go | New type definitions for infracost JSON output; InfracostResourceScopeFree is declared but never used |
| pkg/harness/controller/controller_hooks.go | Adds infracost call after security scan in afterPlan; errors are non-fatal (logged and skipped), consistent with how Scan is handled |
| pkg/harness/tool/v1/types.go | Adds Infracost() to the Tool interface with clear documentation |
| pkg/harness/tool/v1/tool.go | Adds default no-op Infracost() implementation to DefaultTool |
| go.mod | Bumps github.com/pluralsh/console/go/client from v1.74.1 to v1.76.0 to pick up InfracostResources field on StackRunAttributes |
Comments Outside Diff (2)
-
pkg/harness/tool/terraform/infracost.go, line 46-48 (link)Binary plan file passed to infracost
--pathin.planFileNameresolves to"terraform.tfplan"(a binary Terraform plan), butinfracost breakdown --path <file>expects either a Terraform config directory or a JSON plan file (produced byterraform show -json <planfile>). Passing the binary file will cause infracost to fail to parse the path and return an error, so cost estimates will never be populated in practice.The standard approach is to produce a JSON plan first with
terraform show -json terraform.tfplan > plan.json, then passplan.jsonto--path. -
pkg/harness/tool/terraform/infracost_types.go, line 64 (link)Unused constant
InfracostResourceScopeFreeInfracostResourceScopeFreeis declared but never referenced anywhere in the codebase. Resources with no cost are filtered out inconvertResource(bothhourlyCostandmonthlyCostare nil →return nil), so this scope value never gets assigned. Either use it to tag free resources instead of discarding them, or remove the constant to avoid confusion.
Reviews (1): Last reviewed commit: "Merge branch 'main' into infracost" | Re-trigger Greptile
Test Plan
https://console.kinjal-gitgud.onplural.sh/
Checklist