Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing ProductFilter property from some supported resources #226

Merged
merged 20 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Name Monthly Qty Unit Monthly Cost

ibm_cos_bucket.accelerated-archive-us-south
├─ Accelerated Archive Capacity Monthly cost depends on usage: $0.00418 per GB
├─ Accelerated Archive Capacity Monthly cost depends on usage: $0.005225 per GB
├─ Accelerated Archive Restore Monthly cost depends on usage: $0.0418 per GB
├─ Storage Capacity (first 499999 GB) Monthly cost depends on usage: $0.02299 per GB
├─ Storage Capacity (over 499999 GB) Monthly cost depends on usage: $0.0209 per GB
Expand All @@ -13,7 +13,7 @@
└─ Public Standard Egress (over 150000 GB) Monthly cost depends on usage: $0.05 per GB

ibm_cos_bucket.archive-us-south
├─ Archive Capacity 1,000 GB $1.03
├─ Archive Capacity 1,000 GB $1.30
├─ Archive Restore 1,000 GB $20.90
├─ Storage Capacity (first 499999 GB) Monthly cost depends on usage: $0.02299 per GB
├─ Storage Capacity (over 499999 GB) Monthly cost depends on usage: $0.0209 per GB
Expand Down Expand Up @@ -93,7 +93,7 @@
└─ Public Standard Egress (next 100000 GB) 0 GB $0.00
└─ Public Standard Egress (over 150000 GB) 0 GB $0.00

OVERALL TOTAL $495.12
OVERALL TOTAL $495.39
──────────────────────────────────
14 cloud resources were detected:
∙ 13 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
└─ Lite plan 1 $0.00

ibm_resource_instance.resource_instance_power_iaas
└─ test 1 Instance $0.00
└─ Workspace for Power Virtual Server 1 Workspace $0.00

ibm_resource_instance.resource_instance_secrets_manager
├─ Instance 1 Instance $321.00
Expand Down
8 changes: 8 additions & 0 deletions internal/resources/ibm/ibm_cos_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,14 @@ func (r *IbmCosBucket) LitePlanCostComponent() *schema.CostComponent {
Unit: "Instance",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: strPtr(("cloud-object-storage")),
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return &costComponent
Expand Down
77 changes: 70 additions & 7 deletions internal/resources/ibm/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,17 @@ func GetSecretsManagerCostComponents(r *ResourceInstance) []*schema.CostComponen
}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan: %s", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand All @@ -327,13 +335,20 @@ func GetSecretsManagerCostComponents(r *ResourceInstance) []*schema.CostComponen
}

func GetPowerCostComponents(r *ResourceInstance) []*schema.CostComponent {
q := decimalPtr(decimal.NewFromInt(1))

costComponent := schema.CostComponent{
Name: r.Name,
Unit: "Instance",
Name: "Workspace for Power Virtual Server",
Unit: "Workspace",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: q,
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down Expand Up @@ -425,9 +440,17 @@ func GetAppIDCostComponents(r *ResourceInstance) []*schema.CostComponent {
}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan: %s", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down Expand Up @@ -525,16 +548,32 @@ func GetAppConnectCostComponents(r *ResourceInstance) []*schema.CostComponent {
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
&costComponent,
}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand All @@ -553,6 +592,14 @@ func GetLogDNACostComponents(r *ResourceInstance) []*schema.CostComponent {
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down Expand Up @@ -589,6 +636,14 @@ func GetActivityTrackerCostComponents(r *ResourceInstance) []*schema.CostCompone
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{costComponent}
Expand Down Expand Up @@ -623,6 +678,14 @@ func GetContinuousDeliveryCostComponenets(r *ResourceInstance) []*schema.CostCom
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{costComponent}
Expand Down
18 changes: 17 additions & 1 deletion internal/resources/ibm/resource_instance_aiopenscale.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,30 @@ func GetWGOVCostComponents(r *ResourceInstance) []*schema.CostComponent {
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{costComponent}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down
26 changes: 25 additions & 1 deletion internal/resources/ibm/resource_instance_conversation.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ func GetWACostComponents(r *ResourceInstance) []*schema.CostComponent {
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand All @@ -41,16 +49,32 @@ func GetWACostComponents(r *ResourceInstance) []*schema.CostComponent {
Name: "Trial",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
&costComponent,
}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down
10 changes: 9 additions & 1 deletion internal/resources/ibm/resource_instance_discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,17 @@ func GetWDCostComponents(r *ResourceInstance) []*schema.CostComponent {
}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1), // Final quantity for this cost component will be divided by this amount
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down
10 changes: 9 additions & 1 deletion internal/resources/ibm/resource_instance_dns-svcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent {
}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1), // Final quantity for this cost component will be divided by this amount
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down
18 changes: 17 additions & 1 deletion internal/resources/ibm/resource_instance_messagehub.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,30 @@ func GetEventStreamsCostComponents(r *ResourceInstance) []*schema.CostComponent
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{costComponent}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down
18 changes: 17 additions & 1 deletion internal/resources/ibm/resource_instance_pm20.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,32 @@ func GetWMLCostComponents(r *ResourceInstance) []*schema.CostComponent {
Name: "Lite plan",
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
&costComponent,
}
} else {
costComponent := schema.CostComponent{
Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan),
Name: fmt.Sprintf("Plan %s not found", r.Plan),
UnitMultiplier: decimal.NewFromInt(1),
MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)),
ProductFilter: &schema.ProductFilter{
VendorName: strPtr("ibm"),
Region: strPtr(r.Location),
Service: &r.Service,
AttributeFilters: []*schema.AttributeFilter{
{Key: "planName", Value: &r.Plan},
},
},
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0)))
return []*schema.CostComponent{
Expand Down
Loading
Loading