From 3cfa963453336bdb1802739603d92fe0c2052e81 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:08:12 -0500 Subject: [PATCH 01/20] Fix ProductFilter for COS bucket resource --- internal/resources/ibm/ibm_cos_bucket.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/resources/ibm/ibm_cos_bucket.go b/internal/resources/ibm/ibm_cos_bucket.go index 6d5f204ce51..41c9aa09b32 100644 --- a/internal/resources/ibm/ibm_cos_bucket.go +++ b/internal/resources/ibm/ibm_cos_bucket.go @@ -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(""), + 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 From ec422baa9c78a11504fdecdc9b906c238aadbcd6 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:09:01 -0500 Subject: [PATCH 02/20] Fix ProductFilter for Activity Tracker resource --- internal/resources/ibm/resource_instance.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index eda0d1ba7b3..0a58845512a 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -589,6 +589,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} From c4e305cd593bf02a9f52aba4d04522fda93d7260 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:10:59 -0500 Subject: [PATCH 03/20] Fix ProductFilter for App Connect resource --- internal/resources/ibm/resource_instance.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 0a58845512a..6ba0220fe8c 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -525,6 +525,14 @@ 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{ @@ -532,9 +540,17 @@ func GetAppConnectCostComponents(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(""), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, } costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0))) return []*schema.CostComponent{ From bcd272344bdd4125a80a0a9fb59075c5ca31b363 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:14:48 -0500 Subject: [PATCH 04/20] Fix ProductFilter for AppID resource --- internal/resources/ibm/resource_instance.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 6ba0220fe8c..3aa7e7eab5c 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -425,9 +425,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(""), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, } costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0))) return []*schema.CostComponent{ From 7cb9f28abc7d66aff42c4af6417558e119bee799 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:18:04 -0500 Subject: [PATCH 05/20] Fix ProductFilter for Secrets Manager resource --- internal/resources/ibm/resource_instance.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 3aa7e7eab5c..015fa710195 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -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(""), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, } costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0))) return []*schema.CostComponent{ From 52b5aff5688dd319270c86c5e12b7689c4491c32 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:18:36 -0500 Subject: [PATCH 06/20] Fix ProductFilter for Continuous Delivery resource --- internal/resources/ibm/resource_instance.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 015fa710195..d7e79cd8c58 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -663,6 +663,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} From 51e3b2bde99a1266bb8ebc5af3653ceadf6a6bf8 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:38:50 -0500 Subject: [PATCH 07/20] Update golden file with new prices for COS bucket --- .../testdata/ibm_cos_bucket_test/ibm_cos_bucket_test.golden | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/providers/terraform/ibm/testdata/ibm_cos_bucket_test/ibm_cos_bucket_test.golden b/internal/providers/terraform/ibm/testdata/ibm_cos_bucket_test/ibm_cos_bucket_test.golden index bce6688f2eb..c36e5239f79 100644 --- a/internal/providers/terraform/ibm/testdata/ibm_cos_bucket_test/ibm_cos_bucket_test.golden +++ b/internal/providers/terraform/ibm/testdata/ibm_cos_bucket_test/ibm_cos_bucket_test.golden @@ -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 @@ -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 @@ -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 From 06b3687dd60378c1be04870881eb7862f635e29d Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 16:49:24 -0500 Subject: [PATCH 08/20] Fix ProductFilter for DNS resource --- internal/resources/ibm/resource_instance_dns-svcs.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index e4cd703e495..41e593d8bdf 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -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(""), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, } costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0))) return []*schema.CostComponent{ From 6ad043a216b9c017bc8d4e9dd25578d91565f4d6 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 17:25:56 -0500 Subject: [PATCH 09/20] Fix ProductFilter for Event Streams resource --- .../ibm/resource_instance_messagehub.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_messagehub.go b/internal/resources/ibm/resource_instance_messagehub.go index e00becd5e3c..1aadb1a0503 100644 --- a/internal/resources/ibm/resource_instance_messagehub.go +++ b/internal/resources/ibm/resource_instance_messagehub.go @@ -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(""), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, } costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0))) return []*schema.CostComponent{ From 0bc020af042d18935f5bd77fc562bc50f702cad4 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 17:28:59 -0500 Subject: [PATCH 10/20] Fix ProductFilter for LogDNA resource --- internal/resources/ibm/resource_instance.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index d7e79cd8c58..da24cbd6429 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -585,6 +585,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{ From 7fe7836a292340f883338966e020e276bb41d471 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 17:54:10 -0500 Subject: [PATCH 11/20] Fix ProductFilter & terminology for PowerVS workspace resource --- .../resource_instance_test.golden | 2 +- internal/resources/ibm/resource_instance.go | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.golden b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.golden index f8ef2cd0909..d92343b38f2 100644 --- a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.golden +++ b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.golden @@ -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 diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index da24cbd6429..a48bb915583 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -335,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{ From d42f59f2ade6124d366ab70142c4a77002a2ef1d Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 17:58:40 -0500 Subject: [PATCH 12/20] Fix ProductFilter for SCC resource --- .../resources/ibm/resource_instance_scc.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_scc.go b/internal/resources/ibm/resource_instance_scc.go index c052b59e33c..ee7bff6cab6 100644 --- a/internal/resources/ibm/resource_instance_scc.go +++ b/internal/resources/ibm/resource_instance_scc.go @@ -20,6 +20,14 @@ func GetSCCCostComponents(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{ @@ -27,9 +35,17 @@ func GetSCCCostComponents(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(""), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, } costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0))) return []*schema.CostComponent{ From edfe59ebb58d46300a1151d1d1cef81f099f09cd Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:01:18 -0500 Subject: [PATCH 13/20] Set 'VendorName' to 'ibm' --- internal/resources/ibm/ibm_cos_bucket.go | 2 +- internal/resources/ibm/resource_instance.go | 6 +++--- internal/resources/ibm/resource_instance_dns-svcs.go | 2 +- internal/resources/ibm/resource_instance_messagehub.go | 2 +- internal/resources/ibm/resource_instance_scc.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/resources/ibm/ibm_cos_bucket.go b/internal/resources/ibm/ibm_cos_bucket.go index 41c9aa09b32..1ff7a812b3e 100644 --- a/internal/resources/ibm/ibm_cos_bucket.go +++ b/internal/resources/ibm/ibm_cos_bucket.go @@ -734,7 +734,7 @@ func (r *IbmCosBucket) LitePlanCostComponent() *schema.CostComponent { UnitMultiplier: decimal.NewFromInt(1), MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)), ProductFilter: &schema.ProductFilter{ - VendorName: strPtr(""), + VendorName: strPtr("ibm"), Region: strPtr(r.Location), Service: strPtr(("cloud-object-storage")), AttributeFilters: []*schema.AttributeFilter{ diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index a48bb915583..87676fdbb8f 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -319,7 +319,7 @@ func GetSecretsManagerCostComponents(r *ResourceInstance) []*schema.CostComponen UnitMultiplier: decimal.NewFromInt(1), MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)), ProductFilter: &schema.ProductFilter{ - VendorName: strPtr(""), + VendorName: strPtr("ibm"), Region: strPtr(r.Location), Service: &r.Service, AttributeFilters: []*schema.AttributeFilter{ @@ -444,7 +444,7 @@ func GetAppIDCostComponents(r *ResourceInstance) []*schema.CostComponent { UnitMultiplier: decimal.NewFromInt(1), MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)), ProductFilter: &schema.ProductFilter{ - VendorName: strPtr(""), + VendorName: strPtr("ibm"), Region: strPtr(r.Location), Service: &r.Service, AttributeFilters: []*schema.AttributeFilter{ @@ -567,7 +567,7 @@ func GetAppConnectCostComponents(r *ResourceInstance) []*schema.CostComponent { UnitMultiplier: decimal.NewFromInt(1), MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)), ProductFilter: &schema.ProductFilter{ - VendorName: strPtr(""), + VendorName: strPtr("ibm"), Region: strPtr(r.Location), Service: &r.Service, AttributeFilters: []*schema.AttributeFilter{ diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 41e593d8bdf..bcc11b6d356 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -27,7 +27,7 @@ func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { 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(""), + VendorName: strPtr("ibm"), Region: strPtr(r.Location), Service: &r.Service, AttributeFilters: []*schema.AttributeFilter{ diff --git a/internal/resources/ibm/resource_instance_messagehub.go b/internal/resources/ibm/resource_instance_messagehub.go index 1aadb1a0503..43a714d9737 100644 --- a/internal/resources/ibm/resource_instance_messagehub.go +++ b/internal/resources/ibm/resource_instance_messagehub.go @@ -54,7 +54,7 @@ func GetEventStreamsCostComponents(r *ResourceInstance) []*schema.CostComponent UnitMultiplier: decimal.NewFromInt(1), MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)), ProductFilter: &schema.ProductFilter{ - VendorName: strPtr(""), + VendorName: strPtr("ibm"), Region: strPtr(r.Location), Service: &r.Service, AttributeFilters: []*schema.AttributeFilter{ diff --git a/internal/resources/ibm/resource_instance_scc.go b/internal/resources/ibm/resource_instance_scc.go index ee7bff6cab6..75d773025ca 100644 --- a/internal/resources/ibm/resource_instance_scc.go +++ b/internal/resources/ibm/resource_instance_scc.go @@ -39,7 +39,7 @@ func GetSCCCostComponents(r *ResourceInstance) []*schema.CostComponent { 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(""), + VendorName: strPtr("ibm"), Region: strPtr(r.Location), Service: &r.Service, AttributeFilters: []*schema.AttributeFilter{ From c79ee00c50801031ee4bd8a3137ec4fcc7107b67 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:01:57 -0500 Subject: [PATCH 14/20] Fix ProductFilter for SCCWP resource --- .../ibm/resource_instance_sysdig-secure.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_sysdig-secure.go b/internal/resources/ibm/resource_instance_sysdig-secure.go index 9dfed84a7c3..bb49b8114cf 100644 --- a/internal/resources/ibm/resource_instance_sysdig-secure.go +++ b/internal/resources/ibm/resource_instance_sysdig-secure.go @@ -16,6 +16,14 @@ func GetSCCWPCostComponents(r *ResourceInstance) []*schema.CostComponent { Name: "Free 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{ @@ -29,9 +37,17 @@ func GetSCCWPCostComponents(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{ From 1172b549d12f81b0bb6eeb3998a7c774153dee0e Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:03:44 -0500 Subject: [PATCH 15/20] Fix ProductFilter for Sysdig resource --- .../resources/ibm/resource_instance_sysdig-monitor.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/resources/ibm/resource_instance_sysdig-monitor.go b/internal/resources/ibm/resource_instance_sysdig-monitor.go index e9ff57b7644..9b341537d8c 100644 --- a/internal/resources/ibm/resource_instance_sysdig-monitor.go +++ b/internal/resources/ibm/resource_instance_sysdig-monitor.go @@ -108,6 +108,14 @@ func GetSysdigCostComponenets(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} From 072326f93b5932322b944deb5e23c21c419f6c3a Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:06:18 -0500 Subject: [PATCH 16/20] Fix ProductFilter for Watson Assistant resource --- .../ibm/resource_instance_conversation.go | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_conversation.go b/internal/resources/ibm/resource_instance_conversation.go index 82a680b9be6..af019e32170 100644 --- a/internal/resources/ibm/resource_instance_conversation.go +++ b/internal/resources/ibm/resource_instance_conversation.go @@ -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{ @@ -41,6 +49,14 @@ 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{ @@ -48,9 +64,17 @@ func GetWACostComponents(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{ From 2db987d2171027b39f841b1ba41dc78dd61ecd7c Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:07:46 -0500 Subject: [PATCH 17/20] Fix ProductFilter for Watson Discovery resource --- internal/resources/ibm/resource_instance_discovery.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_discovery.go b/internal/resources/ibm/resource_instance_discovery.go index fbff2f59bb1..62a5faaae31 100644 --- a/internal/resources/ibm/resource_instance_discovery.go +++ b/internal/resources/ibm/resource_instance_discovery.go @@ -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{ From a321138d2834c36a925f5fcdcf256c0760ada0f9 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:08:16 -0500 Subject: [PATCH 18/20] Fix ProductFilter for Watsonx Governance resource --- .../ibm/resource_instance_aiopenscale.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_aiopenscale.go b/internal/resources/ibm/resource_instance_aiopenscale.go index be051b05e34..f7f96a9d6c1 100644 --- a/internal/resources/ibm/resource_instance_aiopenscale.go +++ b/internal/resources/ibm/resource_instance_aiopenscale.go @@ -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{ From b556180fe347434d0d37198d7c8f4e5e45632bba Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:11:06 -0500 Subject: [PATCH 19/20] Fix ProductFilter for Watsonx ML resource --- .../resources/ibm/resource_instance_pm20.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/resources/ibm/resource_instance_pm20.go b/internal/resources/ibm/resource_instance_pm20.go index a25d01a6cd9..0d798757719 100644 --- a/internal/resources/ibm/resource_instance_pm20.go +++ b/internal/resources/ibm/resource_instance_pm20.go @@ -35,6 +35,14 @@ 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{ @@ -42,9 +50,17 @@ func GetWMLCostComponents(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{ From 94aeaa254e2ecaaa052f3180567c6d5e73c4eb32 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 5 Nov 2024 18:11:45 -0500 Subject: [PATCH 20/20] 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{