Documentation
¶
Overview ¶
Package parser loads Terraform plan JSON into a normalized resource list.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProviderForType ¶
ProviderForType maps a Terraform resource type to the pricing provider that serves it, based on the type's provider prefix.
Types ¶
type Plan ¶
type Plan struct {
FormatVersion string `json:"format_version"`
Resources []PlannedResource `json:"-"`
}
func LoadPlanJSON ¶
LoadPlanJSON parses `terraform show -json <plan>` output. Only "create" and "update" actions contribute to cost; "delete" resources are handled in diff mode.
type PlannedResource ¶
type PlannedResource struct {
Address string `json:"address"`
Type string `json:"type"` // e.g. "tencentcloud_instance"
Name string `json:"name"`
After map[string]interface{} `json:"after"` // resource_changes[].change.after
Region string `json:"region,omitempty"`
}
PlannedResource is one row we hand to the pricing engine. It intentionally keeps the raw attribute map so per-type mappers can pull what they need (instance_type, data_disks, charge_type, etc.).
type UsageOverrides ¶
UsageOverrides maps resource address -> arbitrary usage key/value pairs. Example:
tencentcloud_cos_bucket.static_site: monthly_storage_gb: 200 monthly_get_requests: 1000000
Unknown fields are preserved and consumed by mapper-specific Extract logic.
func LoadUsageYAML ¶
func LoadUsageYAML(path string) (UsageOverrides, error)
LoadUsageYAML reads usage assumptions from YAML. Empty path means "no overrides" and returns an empty map.