From 94aeaa254e2ecaaa052f3180567c6d5e73c4eb32 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:11:45 -0500 Subject: [PATCH] Fix ProductFilter for Watson Studio resource --- .../resources/ibm/resource_instance_studio.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_studio.go b/internal/resources/ibm/resource_instance_studio.go index 2f07fb2c301..2fe546e8588 100644 --- a/internal/resources/ibm/resource_instance_studio.go +++ b/internal/resources/ibm/resource_instance_studio.go @@ -21,6 +21,14 @@ func GetWSCostComponents(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{ @@ -28,9 +36,17 @@ func GetWSCostComponents(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), 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{