From d3e37cf7a763f942ccdd1d3143de3492a76b78ac Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 7 May 2024 10:26:59 -0400 Subject: [PATCH 01/16] Create new file for resource_instance type dns-svcs --- internal/resources/ibm/resource_instance_dns-svcs.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 internal/resources/ibm/resource_instance_dns-svcs.go diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go new file mode 100644 index 00000000000..e69de29bb2d From 340d01dbfba8d4460693276935de8041959bb3e2 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 7 May 2024 15:27:00 -0400 Subject: [PATCH 02/16] Add cost component functions --- .../ibm/resource_instance_dns-svcs.go | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index e69de29bb2d..312865e02e5 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -0,0 +1,63 @@ +package ibm + +import ( + "fmt" + + "github.com/infracost/infracost/internal/schema" + "github.com/shopspring/decimal" +) + +// Graduated Tier pricing model +const DNS_SERVICES_PROGRAMMATIC_PLAN_NAME string = "standard-dns" + +func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { + if r.Plan == DNS_SERVICES_PROGRAMMATIC_PLAN_NAME { + return []*schema.CostComponent{ + // DNSServicesZonesCostComponents(r), + // DNSServicesPoolsPerHourCostComponents(r), + // DNSServicesGLBInstancesPerHourCostComponents(r), + // DNSServicesNumHealthChecksCostComponents(r), + // DNSServicesCustomResolverLocationsPerHourCostComponents(r), + // DNSServicesMillionCustomResolverExternalQueriesCostComponents(r), + // DNSServicesMillionDNSQueriesCostComponents(r) + } + } else { + costComponent := schema.CostComponent{ + Name: fmt.Sprintf("Plan %s with customized pricing", r.Plan), + UnitMultiplier: decimal.NewFromInt(1), // Final quantity for this cost component will be divided by this amount + MonthlyQuantity: decimalPtr(decimal.NewFromInt(1)), + } + costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0))) + return []*schema.CostComponent{ + &costComponent, + } + } +} + +// Unit: ITEMS (Linear Tier) +func DNSServicesZonesCostComponents(r *ResourceInstance) []*schema.CostComponent { +} + +// Unit: NUMBERGLB (Linear Tier) +func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) []*schema.CostComponent { +} + +// Unit: NUMBERPOOLS (Linear Tier) +func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) []*schema.CostComponent { +} + +// Unit: NUMBERHEALTHCHECK (Linear Tier) +func DNSServicesNumHealthChecksCostComponents(r *ResourceInstance) []*schema.CostComponent { +} + +// Unit: RESOLVERLOCATIONS (Linear Tier) +func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance) []*schema.CostComponent { +} + +// Unit: MILLION_ITEMS_CREXTERNALQUERIES (Graduated Tier) +func DNSServicesMillionCustomResolverExternalQueriesCostComponents(r *ResourceInstance) []*schema.CostComponent { +} + +// Unit: MILLION_ITEMS (Graduated Tier) +func DNSServicesMillionDNSQueriesCostComponents(r *ResourceInstance) []*schema.CostComponent { +} From 2c0f0d648891b58f78888db16cf38297890b8eec Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 7 May 2024 16:25:24 -0400 Subject: [PATCH 03/16] Complete linear tier cost components --- .../ibm/resource_instance_dns-svcs.go | 124 ++++++++++++++++-- 1 file changed, 112 insertions(+), 12 deletions(-) diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 312865e02e5..94d8571172a 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -16,7 +16,7 @@ func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { // DNSServicesZonesCostComponents(r), // DNSServicesPoolsPerHourCostComponents(r), // DNSServicesGLBInstancesPerHourCostComponents(r), - // DNSServicesNumHealthChecksCostComponents(r), + // DNSServicesHealthChecksCostComponents(r), // DNSServicesCustomResolverLocationsPerHourCostComponents(r), // DNSServicesMillionCustomResolverExternalQueriesCostComponents(r), // DNSServicesMillionDNSQueriesCostComponents(r) @@ -35,29 +35,129 @@ func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { } // Unit: ITEMS (Linear Tier) -func DNSServicesZonesCostComponents(r *ResourceInstance) []*schema.CostComponent { +func DNSServicesZonesCostComponents(r *ResourceInstance) *schema.CostComponent { + + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_Zones)) // Quantity of current cost component (i.e. Number of zones) + + return &schema.CostComponent{ + Name: "Zones", + Unit: "Zones", + UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount + MonthlyQuantity: quantity, + ProductFilter: &schema.ProductFilter{ + VendorName: strPtr("ibm"), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, + PriceFilter: &schema.PriceFilter{ + Unit: strPtr("ITEMS"), + }, + } } // Unit: NUMBERGLB (Linear Tier) -func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) []*schema.CostComponent { +func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { + + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_PoolsPerHour)) // Quantity of current cost component (i.e. Number of zones) + + return &schema.CostComponent{ + Name: "Pools Per Hour", + Unit: "Pools Per Hour", + UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount + MonthlyQuantity: quantity, + ProductFilter: &schema.ProductFilter{ + VendorName: strPtr("ibm"), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, + PriceFilter: &schema.PriceFilter{ + Unit: strPtr("NUMBERGLB"), + }, + } } // Unit: NUMBERPOOLS (Linear Tier) -func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) []*schema.CostComponent { +func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { + + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_GLBInstancesPerHour)) // Quantity of current cost component (i.e. Number of zones) + + return &schema.CostComponent{ + Name: "GLB Instances Per Hour", + Unit: "GLB Instances Per Hour", + UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount + MonthlyQuantity: quantity, + ProductFilter: &schema.ProductFilter{ + VendorName: strPtr("ibm"), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, + PriceFilter: &schema.PriceFilter{ + Unit: strPtr("NUMBERPOOLS"), + }, + } } // Unit: NUMBERHEALTHCHECK (Linear Tier) -func DNSServicesNumHealthChecksCostComponents(r *ResourceInstance) []*schema.CostComponent { +func DNSServicesHealthChecksCostComponents(r *ResourceInstance) *schema.CostComponent { + + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_HealthChecks)) // Quantity of current cost component (i.e. Number of zones) + + return &schema.CostComponent{ + Name: "Health Checks", + Unit: "Health Checks", + UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount + MonthlyQuantity: quantity, + ProductFilter: &schema.ProductFilter{ + VendorName: strPtr("ibm"), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, + PriceFilter: &schema.PriceFilter{ + Unit: strPtr("NUMBERHEALTHCHECK"), + }, + } } // Unit: RESOLVERLOCATIONS (Linear Tier) -func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance) []*schema.CostComponent { -} +func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { -// Unit: MILLION_ITEMS_CREXTERNALQUERIES (Graduated Tier) -func DNSServicesMillionCustomResolverExternalQueriesCostComponents(r *ResourceInstance) []*schema.CostComponent { -} + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_CustomResolverLocationsPerHour)) // Quantity of current cost component (i.e. Number of zones) -// Unit: MILLION_ITEMS (Graduated Tier) -func DNSServicesMillionDNSQueriesCostComponents(r *ResourceInstance) []*schema.CostComponent { + return &schema.CostComponent{ + Name: "Custom Resolver Locations Per Hour", + Unit: "Custom Resolver Locations Per Hour", + UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount + MonthlyQuantity: quantity, + ProductFilter: &schema.ProductFilter{ + VendorName: strPtr("ibm"), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, + PriceFilter: &schema.PriceFilter{ + Unit: strPtr("RESOLVERLOCATIONS"), + }, + } } + +// // Unit: MILLION_ITEMS_CREXTERNALQUERIES (Graduated Tier) +// func DNSServicesMillionCustomResolverExternalQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { +// } + +// // Unit: MILLION_ITEMS (Graduated Tier) +// func DNSServicesMillionDNSQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { +// } From 7e2a63c731c7981488bfc974ec4b10d16d8afc44 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 7 May 2024 18:11:09 -0400 Subject: [PATCH 04/16] Complete support code for dns-svcs --- infracost-usage-example.yml | 16 + internal/providers/terraform/ibm/ibm.go | 1 + .../resource_instance_test.golden | 355 +++++++++--------- .../resource_instance_test.tf | 8 + .../resource_instance_test.usage.yml | 11 +- internal/resources/ibm/resource_instance.go | 16 + .../ibm/resource_instance_dns-svcs.go | 131 +++++-- 7 files changed, 331 insertions(+), 207 deletions(-) diff --git a/infracost-usage-example.yml b/infracost-usage-example.yml index 059ce6b95ce..0c59ec38b1e 100644 --- a/infracost-usage-example.yml +++ b/infracost-usage-example.yml @@ -84,6 +84,13 @@ resource_type_default_usage: sysdig-secure_VM_NODE_HOUR: 501 aiopenscale_RESOURCE_UNITS: 1 aiopenscale_MODELS_PER_MONTH: 1 + dns-svcs_ITEMS: 2 # Linear; 1 zone included + dns-svcs_MILLION_ITEMS: 10000 # Tiered; 1-999, 999+ + dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ + dns-svcs_NUMBERGLB: 1 # Linear + dns-svcs_NUMBERHEALTHCHECK: 1 # Linear + dns-svcs_NUMBERPOOLS: 1 # Linear + dns-svcs_RESOLVERLOCATIONS: 1 # Linear ibm_tg_gateway: connection: 3 data_transfer_global: 1000 @@ -1351,6 +1358,15 @@ resource_usage: ibm_resource_instance.watson_governance_standard_v2: aiopenscale_MODELS_PER_MONTH: 1 + ibm_resource_instance.dns_services: + dns-svcs_ITEMS: 2 + dns-svcs_MILLION_ITEMS: 10000 + dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 + dns-svcs_NUMBERGLB: 1 + dns-svcs_NUMBERHEALTHCHECK: 1 + dns-svcs_NUMBERPOOLS: 1 + dns-svcs_RESOLVERLOCATIONS: 1 + ibm_tg_gateway.tg_gateway: connection: 25 # Monthly number of connections to the gateway data_transfer_local: 2500 # Monthly local traffic through the gateway in GB diff --git a/internal/providers/terraform/ibm/ibm.go b/internal/providers/terraform/ibm/ibm.go index aabdb54355c..66a8e9584ba 100644 --- a/internal/providers/terraform/ibm/ibm.go +++ b/internal/providers/terraform/ibm/ibm.go @@ -86,6 +86,7 @@ var globalCatalogServiceId = map[string]catalogMetadata{ "logdnaat": {"dcc46a60-e13b-11e8-a015-757410dab16b", []string{}, nil, "https://cloud.ibm.com/catalog/services/logdnaat"}, "continuous-delivery": {"59b735ee-5938-4ebd-a6b2-541aef2d1f68", []string{}, nil, "https://cloud.ibm.com/catalog/services/continuous-delivery"}, "compliance": {"compliance", []string{}, nil, "https://cloud.ibm.com/catalog/services/security-and-compliance-center"}, + "dns-svcs": {"b4ed8a30-936f-11e9-b289-1d079699cbe5", []string{}, nil, "https://cloud.ibm.com/catalog/services/dns-services"}, } func SetCatalogMetadata(d *schema.ResourceData, resourceType string, config map[string]any) { 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 9ab47333f33..cfa7afff47c 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 @@ -1,174 +1,185 @@ - Name Monthly Qty Unit Monthly Cost - - ibm_resource_instance.cd_instance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.cd_instance_professional - └─ Authorized Users 2 Authorized Users $75.40 - - ibm_resource_instance.resource_instance_activity_tracker_7day - └─ Gigabyte Months 10 Gigabyte Months $16.15 - - ibm_resource_instance.resource_instance_activity_tracker_7day_no_usage - └─ Gigabyte Months Monthly cost depends on usage: $1.61 per Gigabyte Months - - ibm_resource_instance.resource_instance_activity_tracker_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.resource_instance_appid - ├─ Users (first 1 Users) 1 Users $0.00 - ├─ Users (next 9 Users) 9 Users $0.02 - ├─ Users (next 90 Users) 90 Users $0.15 - ├─ Users (next 900 Users) 900 Users $1.36 - ├─ Users (next 4000 Users) 0 Users $0.00 - ├─ Users (over 5000 Users) 0 Users $0.00 - ├─ Authentications (first 1 Authentications) 1 Authentications $0.00 - ├─ Authentications (next 9 Authentications) 9 Authentications $0.04 - ├─ Authentications (next 90 Authentications) 90 Authentications $0.30 - ├─ Authentications (next 900 Authentications) 900 Authentications $2.24 - ├─ Authentications (next 4000 Authentications) 4,000 Authentications $6.64 - ├─ Authentications (over 5000 Authentications) 10,000 Authentications $8.29 - └─ Advanced Authentications (first 10 Authentications) 10 Authentications $0.22 - └─ Advanced Authentications (next 99990 Authentications) 19,990 Authentications $429.79 - └─ Advanced Authentications (over 100000 Authentications) 0 Authentications $0.00 - - ibm_resource_instance.resource_instance_kms - ├─ Key versions free allowance (first 5 Key Versions) 5 Key Versions $0.00 - └─ Key versions 295 Key Versions $317.52 - - ibm_resource_instance.resource_instance_logdna_14day - └─ Gigabyte Months (14-day) 1 Gigabyte Months $2.15 - - ibm_resource_instance.resource_instance_logdna_30day - └─ Gigabyte Months (30-day) 1 Gigabyte Months $3.23 - - ibm_resource_instance.resource_instance_logdna_7day - └─ Gigabyte Months (7-day) 1 Gigabyte Months $1.50 - - ibm_resource_instance.resource_instance_logdna_7day_no_usage - └─ Gigabyte Months (7-day) Monthly cost depends on usage: $1.50 per Gigabyte Months - - ibm_resource_instance.resource_instance_logdna_hipaa30day - └─ Gigabyte Months (hipaa-30-day) 1 Gigabyte Months $4.12 - - ibm_resource_instance.resource_instance_logdna_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.resource_instance_monitoring_graduated - ├─ Additional Time series (first 1000 Time series hour) 100 Time series hour $0.01 - ├─ Additional Time series (next 9000 Time series hour) 0 Time series hour $0.00 - ├─ Additional Time series (next 90000 Time series hour) 0 Time series hour $0.00 - ├─ Additional Time series (over 100000 Time series hour) 0 Time series hour $0.00 - ├─ Additional Container Hours 1,460 Container Hours $1.09 - ├─ Additional API Calls 100,000 API Calls $1.08 - └─ Node Hours 730 Node Hours $37.72 - - ibm_resource_instance.resource_instance_monitoring_graduated_no_usage - ├─ Additional Time series (first 1000 Time series hour) Monthly cost depends on usage: $0.0001195944 per Time series hour - ├─ Additional Time series (next 9000 Time series hour) Monthly cost depends on usage: $0.0000747465 per Time series hour - ├─ Additional Time series (next 90000 Time series hour) Monthly cost depends on usage: $0.0000448479 per Time series hour - ├─ Additional Time series (over 100000 Time series hour) Monthly cost depends on usage: $0.0000298986 per Time series hour - ├─ Additional Container Hours Monthly cost depends on usage: $0.0007474653 per Container Hours - ├─ Additional API Calls Monthly cost depends on usage: $0.0000107635 per API Calls - └─ Node Hours Monthly cost depends on usage: $0.0516648 per Node Hours - - ibm_resource_instance.resource_instance_monitoring_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.resource_instance_power_iaas - └─ test 1 Instance $0.00 - - ibm_resource_instance.resource_instance_secrets_manager - ├─ Instance 1 Instance $321.00 - └─ Active Secrets 400 Secrets $86.00 - - ibm_resource_instance.scc_standard - └─ Evaluations 1,000 Evaluations $13.39 - - ibm_resource_instance.scc_trial - └─ Trial 1 $0.00 - - ibm_resource_instance.sccwp_graduated_tier - ├─ Multi-Cloud CSPM Compute Instance Hours (first 25 Instance-Hours) 25 Instance-Hours $206.00 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 25 Instance-Hours) 25 Instance-Hours $175.10 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 50 Instance-Hours) 50 Instance-Hours $309.00 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 150 Instance-Hours) 150 Instance-Hours $865.20 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 250 Instance-Hours) 250 Instance-Hours $1,236.00 - ├─ Multi-Cloud CSPM Compute Instance Hours (over 500 Instance-Hours) 1 Instance-Hours $4.53 - ├─ Node Hours (first 3 Instance-Hours) 3 Instance-Hours $0.19 - ├─ Node Hours (next 2 Instance-Hours) 2 Instance-Hours $0.11 - ├─ Node Hours (next 5 Instance-Hours) 5 Instance-Hours $0.24 - ├─ Node Hours (next 15 Instance-Hours) 15 Instance-Hours $0.68 - ├─ Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.97 - ├─ Node Hours (over 50 Instance-Hours) 1 Instance-Hours $0.04 - └─ VM Node Hours (first 25 Instance-Hours) 25 Instance-Hours $0.56 - └─ VM Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.47 - └─ VM Node Hours (next 50 Instance-Hours) 50 Instance-Hours $0.83 - └─ VM Node Hours (next 150 Instance-Hours) 150 Instance-Hours $2.33 - └─ VM Node Hours (next 250 Instance-Hours) 250 Instance-Hours $3.33 - └─ VM Node Hours (over 500 Instance-Hours) 1 Instance-Hours $0.01 - - ibm_resource_instance.wa_instance_enterprise - ├─ Instance (50000 MAU included) 1 Instance $6,000.00 - ├─ Additional Monthly Active Users 1 1K MAU $120.00 - └─ Monthly Active Users using voice 1 1K MAU $90.00 - - ibm_resource_instance.wa_instance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.wa_instance_plus - ├─ Instance (1000 MAU included) 1 Instance $140.00 - ├─ Additional Monthly Active Users 10 100 MAU $140.00 - └─ Monthly Active Users using voice 1 100 MAU $9.00 - - ibm_resource_instance.wa_instance_trial - └─ Trial 1 $0.00 - - ibm_resource_instance.watson_discovery_enterprise - ├─ Instance 1 Instance $5,000.00 - ├─ Additional Monthly Documents 1,000 Documents $5.00 - ├─ Additional Monthly Queries 1,000 Queries $5.00 - ├─ Additional Monthly Custom Models 1 Custom Models $500.00 - └─ Additional Monthly Collections 1 Hundred Collections $500.00 - - ibm_resource_instance.watson_discovery_plus - ├─ Instance 1 Instance $500.00 - ├─ Additional Monthly Documents 1,000 Documents $50.00 - └─ Additional Monthly Queries 1,000 Queries $20.00 - - ibm_resource_instance.watson_governance_essentials - └─ Resource Units 100 RU $60.00 - - ibm_resource_instance.watson_governance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.watson_governance_standard_v2 - └─ Deployed Models 1 Model $261.00 - - ibm_resource_instance.watson_studio_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.watson_studio_professional - └─ Capacity Unit-Hours 1 CUH $1.02 - - ibm_resource_instance.wml_instance_essentials - ├─ Capacity Unit-Hours 20 CUH $10.40 - ├─ Class 1 Resource Units 50 RU $0.03 - ├─ Class 2 Resource Units 50 RU $0.09 - └─ Class 3 Resource Units 50 RU $0.25 - - ibm_resource_instance.wml_instance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.wml_instance_standard - ├─ Instance (2500 CUH included) 1 Instance $1,050.00 - ├─ Additional Capacity Unit-Hours Monthly cost depends on usage: $0.42 per CUH - ├─ Class 1 Resource Units 50 RU $0.03 - ├─ Class 2 Resource Units 50 RU $0.09 - └─ Class 3 Resource Units 50 RU $0.25 - - OVERALL TOTAL $18,597.15 + Name Monthly Qty Unit Monthly Cost + + ibm_resource_instance.cd_instance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.cd_instance_professional + └─ Authorized Users 2 Authorized Users $75.40 + + ibm_resource_instance.dns_svcs_standard + ├─ Additional Zones 1 Zones $0.54 + ├─ Pools per Hour 1 Pools $0.04 + ├─ GLB Instances per Hour 1 GLB Instances $0.04 + ├─ Health Checks 1 Health Checks $1.08 + ├─ Custom Resolver Locations per Hour 1 Custom Resolver Locations $0.13 + ├─ Million Custom Resolver External Queries (first 10 Million Queries) 10 Million Queries $4.31 + ├─ Million Custom Resolver External Queries (over 10 Million Queries) 1 Million Queries $0.22 + └─ Additional Million DNS Queries (first 999 Million Queries) 999 Million Queries $645.16 + └─ Additional Million DNS Queries (over 999 Million Queries) 1 Million Queries $0.32 + + ibm_resource_instance.resource_instance_activity_tracker_7day + └─ Gigabyte Months 10 Gigabyte Months $16.15 + + ibm_resource_instance.resource_instance_activity_tracker_7day_no_usage + └─ Gigabyte Months Monthly cost depends on usage: $1.61 per Gigabyte Months + + ibm_resource_instance.resource_instance_activity_tracker_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.resource_instance_appid + ├─ Users (first 1 Users) 1 Users $0.00 + ├─ Users (next 9 Users) 9 Users $0.02 + ├─ Users (next 90 Users) 90 Users $0.15 + ├─ Users (next 900 Users) 900 Users $1.36 + ├─ Users (next 4000 Users) 0 Users $0.00 + ├─ Users (over 5000 Users) 0 Users $0.00 + ├─ Authentications (first 1 Authentications) 1 Authentications $0.00 + ├─ Authentications (next 9 Authentications) 9 Authentications $0.04 + ├─ Authentications (next 90 Authentications) 90 Authentications $0.30 + ├─ Authentications (next 900 Authentications) 900 Authentications $2.24 + ├─ Authentications (next 4000 Authentications) 4,000 Authentications $6.64 + ├─ Authentications (over 5000 Authentications) 10,000 Authentications $8.29 + └─ Advanced Authentications (first 10 Authentications) 10 Authentications $0.22 + └─ Advanced Authentications (next 99990 Authentications) 19,990 Authentications $429.79 + └─ Advanced Authentications (over 100000 Authentications) 0 Authentications $0.00 + + ibm_resource_instance.resource_instance_kms + ├─ Key versions free allowance (first 5 Key Versions) 5 Key Versions $0.00 + └─ Key versions 295 Key Versions $317.52 + + ibm_resource_instance.resource_instance_logdna_14day + └─ Gigabyte Months (14-day) 1 Gigabyte Months $2.15 + + ibm_resource_instance.resource_instance_logdna_30day + └─ Gigabyte Months (30-day) 1 Gigabyte Months $3.23 + + ibm_resource_instance.resource_instance_logdna_7day + └─ Gigabyte Months (7-day) 1 Gigabyte Months $1.50 + + ibm_resource_instance.resource_instance_logdna_7day_no_usage + └─ Gigabyte Months (7-day) Monthly cost depends on usage: $1.50 per Gigabyte Months + + ibm_resource_instance.resource_instance_logdna_hipaa30day + └─ Gigabyte Months (hipaa-30-day) 1 Gigabyte Months $4.12 + + ibm_resource_instance.resource_instance_logdna_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.resource_instance_monitoring_graduated + ├─ Additional Time series (first 1000 Time series hour) 100 Time series hour $0.01 + ├─ Additional Time series (next 9000 Time series hour) 0 Time series hour $0.00 + ├─ Additional Time series (next 90000 Time series hour) 0 Time series hour $0.00 + ├─ Additional Time series (over 100000 Time series hour) 0 Time series hour $0.00 + ├─ Additional Container Hours 1,460 Container Hours $1.09 + ├─ Additional API Calls 100,000 API Calls $1.08 + └─ Node Hours 730 Node Hours $37.72 + + ibm_resource_instance.resource_instance_monitoring_graduated_no_usage + ├─ Additional Time series (first 1000 Time series hour) Monthly cost depends on usage: $0.0001195944 per Time series hour + ├─ Additional Time series (next 9000 Time series hour) Monthly cost depends on usage: $0.0000747465 per Time series hour + ├─ Additional Time series (next 90000 Time series hour) Monthly cost depends on usage: $0.0000448479 per Time series hour + ├─ Additional Time series (over 100000 Time series hour) Monthly cost depends on usage: $0.0000298986 per Time series hour + ├─ Additional Container Hours Monthly cost depends on usage: $0.0007474653 per Container Hours + ├─ Additional API Calls Monthly cost depends on usage: $0.0000107635 per API Calls + └─ Node Hours Monthly cost depends on usage: $0.0516648 per Node Hours + + ibm_resource_instance.resource_instance_monitoring_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.resource_instance_power_iaas + └─ test 1 Instance $0.00 + + ibm_resource_instance.resource_instance_secrets_manager + ├─ Instance 1 Instance $321.00 + └─ Active Secrets 400 Secrets $86.00 + + ibm_resource_instance.scc_standard + └─ Evaluations 1,000 Evaluations $13.39 + + ibm_resource_instance.scc_trial + └─ Trial 1 $0.00 + + ibm_resource_instance.sccwp_graduated_tier + ├─ Multi-Cloud CSPM Compute Instance Hours (first 25 Instance-Hours) 25 Instance-Hours $206.00 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 25 Instance-Hours) 25 Instance-Hours $175.10 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 50 Instance-Hours) 50 Instance-Hours $309.00 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 150 Instance-Hours) 150 Instance-Hours $865.20 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 250 Instance-Hours) 250 Instance-Hours $1,236.00 + ├─ Multi-Cloud CSPM Compute Instance Hours (over 500 Instance-Hours) 1 Instance-Hours $4.53 + ├─ Node Hours (first 3 Instance-Hours) 3 Instance-Hours $0.19 + ├─ Node Hours (next 2 Instance-Hours) 2 Instance-Hours $0.11 + ├─ Node Hours (next 5 Instance-Hours) 5 Instance-Hours $0.24 + ├─ Node Hours (next 15 Instance-Hours) 15 Instance-Hours $0.68 + ├─ Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.97 + ├─ Node Hours (over 50 Instance-Hours) 1 Instance-Hours $0.04 + └─ VM Node Hours (first 25 Instance-Hours) 25 Instance-Hours $0.56 + └─ VM Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.47 + └─ VM Node Hours (next 50 Instance-Hours) 50 Instance-Hours $0.83 + └─ VM Node Hours (next 150 Instance-Hours) 150 Instance-Hours $2.33 + └─ VM Node Hours (next 250 Instance-Hours) 250 Instance-Hours $3.33 + └─ VM Node Hours (over 500 Instance-Hours) 1 Instance-Hours $0.01 + + ibm_resource_instance.wa_instance_enterprise + ├─ Instance (50000 MAU included) 1 Instance $6,000.00 + ├─ Additional Monthly Active Users 1 1K MAU $120.00 + └─ Monthly Active Users using voice 1 1K MAU $90.00 + + ibm_resource_instance.wa_instance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.wa_instance_plus + ├─ Instance (1000 MAU included) 1 Instance $140.00 + ├─ Additional Monthly Active Users 10 100 MAU $140.00 + └─ Monthly Active Users using voice 1 100 MAU $9.00 + + ibm_resource_instance.wa_instance_trial + └─ Trial 1 $0.00 + + ibm_resource_instance.watson_discovery_enterprise + ├─ Instance 1 Instance $5,000.00 + ├─ Additional Monthly Documents 1,000 Documents $5.00 + ├─ Additional Monthly Queries 1,000 Queries $5.00 + ├─ Additional Monthly Custom Models 1 Custom Models $500.00 + └─ Additional Monthly Collections 1 Hundred Collections $500.00 + + ibm_resource_instance.watson_discovery_plus + ├─ Instance 1 Instance $500.00 + ├─ Additional Monthly Documents 1,000 Documents $50.00 + └─ Additional Monthly Queries 1,000 Queries $20.00 + + ibm_resource_instance.watson_governance_essentials + └─ Resource Units 100 RU $60.00 + + ibm_resource_instance.watson_governance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.watson_governance_standard_v2 + └─ Deployed Models 1 Model $261.00 + + ibm_resource_instance.watson_studio_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.watson_studio_professional + └─ Capacity Unit-Hours 1 CUH $1.02 + + ibm_resource_instance.wml_instance_essentials + ├─ Capacity Unit-Hours 20 CUH $10.40 + ├─ Class 1 Resource Units 50 RU $0.03 + ├─ Class 2 Resource Units 50 RU $0.09 + └─ Class 3 Resource Units 50 RU $0.25 + + ibm_resource_instance.wml_instance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.wml_instance_standard + ├─ Instance (2500 CUH included) 1 Instance $1,050.00 + ├─ Additional Capacity Unit-Hours Monthly cost depends on usage: $0.42 per CUH + ├─ Class 1 Resource Units 50 RU $0.03 + ├─ Class 2 Resource Units 50 RU $0.09 + └─ Class 3 Resource Units 50 RU $0.25 + + OVERALL TOTAL $19,248.98 ────────────────────────────────── -36 cloud resources were detected: -∙ 36 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file \ No newline at end of file +37 cloud resources were detected: +∙ 37 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file \ No newline at end of file diff --git a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.tf b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.tf index 220e3bb49cb..12535a912e9 100644 --- a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.tf +++ b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.tf @@ -289,3 +289,11 @@ resource "ibm_resource_instance" "watson_governance_standard_v2" { location = "us-south" resource_group_id = "default" } + +resource "ibm_resource_instance" "dns_svcs_standard" { + name = "dns_svcs_standard" + service = "dns-svcs" + plan = "standard-dns" + location = "global" + resource_group_id = "default" +} \ No newline at end of file diff --git a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml index 504819fd618..d5023ed17cd 100644 --- a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml +++ b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml @@ -67,7 +67,7 @@ resource_usage: wd_instance: 1 # Number of instances used per month wd_documents: 11000 # Number of monthly documents created; 10,000 included in the Plus plan; $50 for every additional 1,000 documents. wd_queries: 11000 # Number of queries documents created; 10,000 included in the Plus plan; $20 for every additional 1,000 queries. - + ibm_resource_instance.watson_discovery_enterprise: wd_instance: 1 # Number of instances used per month wd_documents: 101000 # Number of monthly documents created; 100,000 included in the Enterprise plan; $5 for every additional 1,000 documents. @@ -97,3 +97,12 @@ resource_usage: ibm_resource_instance.watson_governance_standard_v2: aiopenscale_MODELS_PER_MONTH: 1 + + ibm_resource_instance.dns_svcs_standard: + dns-svcs_ITEMS: 2 + dns-svcs_MILLION_ITEMS: 1001 + dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 + dns-svcs_NUMBERGLB: 1 + dns-svcs_NUMBERHEALTHCHECK: 1 + dns-svcs_NUMBERPOOLS: 1 + dns-svcs_RESOLVERLOCATIONS: 1 diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 6eee42d6fec..b0c30a5f2a1 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -85,6 +85,14 @@ type ResourceInstance struct { // Watsonx.governance WGOV_ru *float64 `infracost_usage:"aiopenscale_RESOURCE_UNITS"` WGOV_Models *float64 `infracost_usage:"aiopenscale_MODELS_PER_MONTH"` + // DNS Services + DNSServices_CustomResolverExternalQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES"` + DNSServices_CustomResolverLocationsPerHour *int64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` + DNSServices_DNSQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS"` + DNSServices_GLBInstancesPerHour *int64 `infracost_usage:"dns-svcs_NUMBERGLB"` + DNSServices_HealthChecks *int64 `infracost_usage:"dns-svcs_NUMBERHEALTHCHECK"` + DNSServices_PoolsPerHour *int64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` + DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"` } type ResourceCostComponentsFunc func(*ResourceInstance) []*schema.CostComponent @@ -133,6 +141,13 @@ var ResourceInstanceUsageSchema = []*schema.UsageItem{ {Key: "sysdig-secure_VM_NODE_HOUR", DefaultValue: 0, ValueType: schema.Float64}, {Key: "aiopenscale_RESOURCE_UNITS", DefaultValue: 1, ValueType: schema.Float64}, {Key: "aiopenscale_MODELS_PER_MONTH", DefaultValue: 1, ValueType: schema.Float64}, + {Key: "dns-svcs_ITEMS", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_MILLION_ITEMS", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_NUMBERGLB", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_NUMBERHEALTHCHECK", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_NUMBERPOOLS", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_RESOLVERLOCATIONS", DefaultValue: 1, ValueType: schema.Int64}, } var ResourceInstanceCostMap map[string]ResourceCostComponentsFunc = map[string]ResourceCostComponentsFunc{ @@ -152,6 +167,7 @@ var ResourceInstanceCostMap map[string]ResourceCostComponentsFunc = map[string]R "data-science-experience": GetWSCostComponents, "sysdig-secure": GetSCCWPCostComponents, "aiopenscale": GetWGOVCostComponents, + "dns-svcs": GetDNSServicesCostComponents, } func KMSKeyVersionsFreeCostComponent(r *ResourceInstance) *schema.CostComponent { diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 94d8571172a..2c82688584d 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -13,13 +13,13 @@ const DNS_SERVICES_PROGRAMMATIC_PLAN_NAME string = "standard-dns" func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { if r.Plan == DNS_SERVICES_PROGRAMMATIC_PLAN_NAME { return []*schema.CostComponent{ - // DNSServicesZonesCostComponents(r), - // DNSServicesPoolsPerHourCostComponents(r), - // DNSServicesGLBInstancesPerHourCostComponents(r), - // DNSServicesHealthChecksCostComponents(r), - // DNSServicesCustomResolverLocationsPerHourCostComponents(r), - // DNSServicesMillionCustomResolverExternalQueriesCostComponents(r), - // DNSServicesMillionDNSQueriesCostComponents(r) + DNSServicesZonesCostComponents(r), + DNSServicesPoolsPerHourCostComponents(r), + DNSServicesGLBInstancesPerHourCostComponents(r), + DNSServicesHealthChecksCostComponents(r), + DNSServicesCustomResolverLocationsPerHourCostComponents(r), + DNSServicesMillionCustomResolverExternalQueriesCostComponents(r), + DNSServicesMillionDNSQueriesCostComponents(r), } } else { costComponent := schema.CostComponent{ @@ -37,10 +37,18 @@ func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { // Unit: ITEMS (Linear Tier) func DNSServicesZonesCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_Zones)) // Quantity of current cost component (i.e. Number of zones) + var zones_included int = 1 + var quantity *decimal.Decimal - return &schema.CostComponent{ - Name: "Zones", + additional_zones := *r.DNSServices_Zones - int64(zones_included) + if additional_zones > 0 { + quantity = decimalPtr(decimal.NewFromInt(additional_zones)) + } else { + quantity = decimalPtr(decimal.NewFromInt(0)) + } + + costComponent := schema.CostComponent{ + Name: "Additional Zones", Unit: "Zones", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount MonthlyQuantity: quantity, @@ -56,16 +64,17 @@ func DNSServicesZonesCostComponents(r *ResourceInstance) *schema.CostComponent { Unit: strPtr("ITEMS"), }, } + return &costComponent } -// Unit: NUMBERGLB (Linear Tier) +// Unit: NUMBERPOOLS (Linear Tier) func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_PoolsPerHour)) // Quantity of current cost component (i.e. Number of zones) + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_PoolsPerHour)) - return &schema.CostComponent{ - Name: "Pools Per Hour", - Unit: "Pools Per Hour", + costComponent := schema.CostComponent{ + Name: "Pools per Hour", + Unit: "Pools", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount MonthlyQuantity: quantity, ProductFilter: &schema.ProductFilter{ @@ -77,19 +86,20 @@ func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComp }, }, PriceFilter: &schema.PriceFilter{ - Unit: strPtr("NUMBERGLB"), + Unit: strPtr("NUMBERPOOLS"), }, } + return &costComponent } -// Unit: NUMBERPOOLS (Linear Tier) +// Unit: NUMBERGLB (Linear Tier) func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_GLBInstancesPerHour)) // Quantity of current cost component (i.e. Number of zones) + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_GLBInstancesPerHour)) - return &schema.CostComponent{ - Name: "GLB Instances Per Hour", - Unit: "GLB Instances Per Hour", + costComponent := schema.CostComponent{ + Name: "GLB Instances per Hour", + Unit: "GLB Instances", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount MonthlyQuantity: quantity, ProductFilter: &schema.ProductFilter{ @@ -101,17 +111,18 @@ func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) *schema.C }, }, PriceFilter: &schema.PriceFilter{ - Unit: strPtr("NUMBERPOOLS"), + Unit: strPtr("NUMBERGLB"), }, } + return &costComponent } // Unit: NUMBERHEALTHCHECK (Linear Tier) func DNSServicesHealthChecksCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_HealthChecks)) // Quantity of current cost component (i.e. Number of zones) + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_HealthChecks)) - return &schema.CostComponent{ + costComponent := schema.CostComponent{ Name: "Health Checks", Unit: "Health Checks", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount @@ -128,16 +139,17 @@ func DNSServicesHealthChecksCostComponents(r *ResourceInstance) *schema.CostComp Unit: strPtr("NUMBERHEALTHCHECK"), }, } + return &costComponent } // Unit: RESOLVERLOCATIONS (Linear Tier) func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(*r.DNSServices_CustomResolverLocationsPerHour)) // Quantity of current cost component (i.e. Number of zones) + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_CustomResolverLocationsPerHour)) - return &schema.CostComponent{ - Name: "Custom Resolver Locations Per Hour", - Unit: "Custom Resolver Locations Per Hour", + costComponent := schema.CostComponent{ + Name: "Custom Resolver Locations per Hour", + Unit: "Custom Resolver Locations", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount MonthlyQuantity: quantity, ProductFilter: &schema.ProductFilter{ @@ -152,12 +164,63 @@ func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance Unit: strPtr("RESOLVERLOCATIONS"), }, } + return &costComponent +} + +// Unit: MILLION_ITEMS_CREXTERNALQUERIES (Graduated Tier) +func DNSServicesMillionCustomResolverExternalQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { + + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_CustomResolverExternalQueries)) + + costComponent := schema.CostComponent{ + Name: "Million Custom Resolver External Queries", + Unit: "Million Queries", + UnitMultiplier: decimal.NewFromInt(1), + MonthlyQuantity: quantity, + ProductFilter: &schema.ProductFilter{ + VendorName: strPtr("ibm"), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, + PriceFilter: &schema.PriceFilter{ + Unit: strPtr("MILLION_ITEMS_CREXTERNALQUERIES"), + }, + } + return &costComponent } -// // Unit: MILLION_ITEMS_CREXTERNALQUERIES (Graduated Tier) -// func DNSServicesMillionCustomResolverExternalQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { -// } +// Unit: MILLION_ITEMS (Graduated Tier) +func DNSServicesMillionDNSQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { + + var million_dns_queries_included float32 = 1 + var quantity *decimal.Decimal -// // Unit: MILLION_ITEMS (Graduated Tier) -// func DNSServicesMillionDNSQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { -// } + additional_million_dns_queries := *r.DNSServices_DNSQueries - int64(million_dns_queries_included) + if additional_million_dns_queries > 0 { + quantity = decimalPtr(decimal.NewFromInt(additional_million_dns_queries)) + } else { + quantity = decimalPtr(decimal.NewFromInt(0)) + } + + costComponent := schema.CostComponent{ + Name: "Additional Million DNS Queries", + Unit: "Million Queries", + UnitMultiplier: decimal.NewFromInt(1), + MonthlyQuantity: quantity, + ProductFilter: &schema.ProductFilter{ + VendorName: strPtr("ibm"), + Region: strPtr(r.Location), + Service: &r.Service, + AttributeFilters: []*schema.AttributeFilter{ + {Key: "planName", Value: &r.Plan}, + }, + }, + PriceFilter: &schema.PriceFilter{ + Unit: strPtr("MILLION_ITEMS"), + }, + } + return &costComponent +} From 075624568360ee09e5a35b0803a472429fc14cb4 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 7 May 2024 18:15:06 -0400 Subject: [PATCH 05/16] Clarify comment --- infracost-usage-example.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infracost-usage-example.yml b/infracost-usage-example.yml index 0c59ec38b1e..1202cce0971 100644 --- a/infracost-usage-example.yml +++ b/infracost-usage-example.yml @@ -85,7 +85,7 @@ resource_type_default_usage: aiopenscale_RESOURCE_UNITS: 1 aiopenscale_MODELS_PER_MONTH: 1 dns-svcs_ITEMS: 2 # Linear; 1 zone included - dns-svcs_MILLION_ITEMS: 10000 # Tiered; 1-999, 999+ + dns-svcs_MILLION_ITEMS: 10000 # Tiered; 1-999, 999+, 1 included dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ dns-svcs_NUMBERGLB: 1 # Linear dns-svcs_NUMBERHEALTHCHECK: 1 # Linear From acd7437e726a681a6ce9f17376be9a6b2fc71e57 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 7 May 2024 18:25:54 -0400 Subject: [PATCH 06/16] Update defaults & add comments --- infracost-usage-example.yml | 4 ++-- .../resource_instance_test.usage.yml | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/infracost-usage-example.yml b/infracost-usage-example.yml index 1202cce0971..eda3071b164 100644 --- a/infracost-usage-example.yml +++ b/infracost-usage-example.yml @@ -85,7 +85,7 @@ resource_type_default_usage: aiopenscale_RESOURCE_UNITS: 1 aiopenscale_MODELS_PER_MONTH: 1 dns-svcs_ITEMS: 2 # Linear; 1 zone included - dns-svcs_MILLION_ITEMS: 10000 # Tiered; 1-999, 999+, 1 included + dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ dns-svcs_NUMBERGLB: 1 # Linear dns-svcs_NUMBERHEALTHCHECK: 1 # Linear @@ -1360,7 +1360,7 @@ resource_usage: ibm_resource_instance.dns_services: dns-svcs_ITEMS: 2 - dns-svcs_MILLION_ITEMS: 10000 + dns-svcs_MILLION_ITEMS: 1001 dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 dns-svcs_NUMBERGLB: 1 dns-svcs_NUMBERHEALTHCHECK: 1 diff --git a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml index d5023ed17cd..539cda0d1a4 100644 --- a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml +++ b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml @@ -99,10 +99,10 @@ resource_usage: aiopenscale_MODELS_PER_MONTH: 1 ibm_resource_instance.dns_svcs_standard: - dns-svcs_ITEMS: 2 - dns-svcs_MILLION_ITEMS: 1001 - dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 - dns-svcs_NUMBERGLB: 1 - dns-svcs_NUMBERHEALTHCHECK: 1 - dns-svcs_NUMBERPOOLS: 1 - dns-svcs_RESOLVERLOCATIONS: 1 + dns-svcs_ITEMS: 2 # Linear; 1 zone included + dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included + dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ + dns-svcs_NUMBERGLB: 1 # Linear + dns-svcs_NUMBERHEALTHCHECK: 1 # Linear + dns-svcs_NUMBERPOOLS: 1 # Linear + dns-svcs_RESOLVERLOCATIONS: 1 # Linear From 0b51824ec25606b2f6df554bc736e6591f32ad58 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Wed, 8 May 2024 11:01:12 -0400 Subject: [PATCH 07/16] Add unit vars to consider hours per month --- infracost-usage-example.yml | 7 +++++++ .../resource_instance_test.usage.yml | 3 +++ internal/resources/ibm/resource_instance.go | 20 ++++++++++++------- .../ibm/resource_instance_dns-svcs.go | 6 +++--- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/infracost-usage-example.yml b/infracost-usage-example.yml index eda3071b164..dfbb9a30266 100644 --- a/infracost-usage-example.yml +++ b/infracost-usage-example.yml @@ -84,6 +84,8 @@ resource_type_default_usage: sysdig-secure_VM_NODE_HOUR: 501 aiopenscale_RESOURCE_UNITS: 1 aiopenscale_MODELS_PER_MONTH: 1 + dns-svcs_glb_instance_hours: 1 + dns-svcs_pool_hours: 1 dns-svcs_ITEMS: 2 # Linear; 1 zone included dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ @@ -91,6 +93,8 @@ resource_type_default_usage: dns-svcs_NUMBERHEALTHCHECK: 1 # Linear dns-svcs_NUMBERPOOLS: 1 # Linear dns-svcs_RESOLVERLOCATIONS: 1 # Linear + dns-svcs_custom_resolver_location_hours: 1 + ibm_tg_gateway: connection: 3 data_transfer_global: 1000 @@ -1366,6 +1370,9 @@ resource_usage: dns-svcs_NUMBERHEALTHCHECK: 1 dns-svcs_NUMBERPOOLS: 1 dns-svcs_RESOLVERLOCATIONS: 1 + dns-svcs_custom_resolver_location_hours: 1 + dns-svcs_glb_instance_hours: 1 + dns-svcs_pool_hours: 1 ibm_tg_gateway.tg_gateway: connection: 25 # Monthly number of connections to the gateway diff --git a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml index 539cda0d1a4..6a1d904de5b 100644 --- a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml +++ b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml @@ -106,3 +106,6 @@ resource_usage: dns-svcs_NUMBERHEALTHCHECK: 1 # Linear dns-svcs_NUMBERPOOLS: 1 # Linear dns-svcs_RESOLVERLOCATIONS: 1 # Linear + dns-svcs_custom_resolver_location_hours: 1 + dns-svcs_glb_instance_hours: 1 + dns-svcs_pool_hours: 1 diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index b0c30a5f2a1..9f25cb406dd 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -86,13 +86,16 @@ type ResourceInstance struct { WGOV_ru *float64 `infracost_usage:"aiopenscale_RESOURCE_UNITS"` WGOV_Models *float64 `infracost_usage:"aiopenscale_MODELS_PER_MONTH"` // DNS Services - DNSServices_CustomResolverExternalQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES"` - DNSServices_CustomResolverLocationsPerHour *int64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` - DNSServices_DNSQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS"` - DNSServices_GLBInstancesPerHour *int64 `infracost_usage:"dns-svcs_NUMBERGLB"` - DNSServices_HealthChecks *int64 `infracost_usage:"dns-svcs_NUMBERHEALTHCHECK"` - DNSServices_PoolsPerHour *int64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` - DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"` + DNSServices_CustomResolverExternalQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES"` + DNSServices_CustomResolverLocationHours *float64 `infracost_usage:"dns-svcs_custom_resolver_location_hours"` + DNSServices_CustomResolverLocationsPerHour *int64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` + DNSServices_DNSQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS"` + DNSServices_GLBInstanceHours *float64 `infracost_usage:"dns-svcs_glb_instance_hours"` + DNSServices_GLBInstancesPerHour *int64 `infracost_usage:"dns-svcs_NUMBERGLB"` + DNSServices_HealthChecks *int64 `infracost_usage:"dns-svcs_NUMBERHEALTHCHECK"` + DNSServices_PoolHours *float64 `infracost_usage:"dns-svcs_pool_hours"` + DNSServices_PoolsPerHour *int64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` + DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"` } type ResourceCostComponentsFunc func(*ResourceInstance) []*schema.CostComponent @@ -148,6 +151,9 @@ var ResourceInstanceUsageSchema = []*schema.UsageItem{ {Key: "dns-svcs_NUMBERHEALTHCHECK", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_NUMBERPOOLS", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_RESOLVERLOCATIONS", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_custom_resolver_location_hours", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_glb_instance_hours", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_pool_hours", DefaultValue: 1, ValueType: schema.Int64}, } var ResourceInstanceCostMap map[string]ResourceCostComponentsFunc = map[string]ResourceCostComponentsFunc{ diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 2c82688584d..af0c0599db7 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -70,7 +70,7 @@ func DNSServicesZonesCostComponents(r *ResourceInstance) *schema.CostComponent { // Unit: NUMBERPOOLS (Linear Tier) func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_PoolsPerHour)) + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolsPerHour) * *r.DNSServices_PoolHours)) costComponent := schema.CostComponent{ Name: "Pools per Hour", @@ -95,7 +95,7 @@ func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComp // Unit: NUMBERGLB (Linear Tier) func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_GLBInstancesPerHour)) + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstancesPerHour) * *r.DNSServices_GLBInstanceHours)) costComponent := schema.CostComponent{ Name: "GLB Instances per Hour", @@ -145,7 +145,7 @@ func DNSServicesHealthChecksCostComponents(r *ResourceInstance) *schema.CostComp // Unit: RESOLVERLOCATIONS (Linear Tier) func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_CustomResolverLocationsPerHour)) + var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationsPerHour) * *r.DNSServices_CustomResolverLocationHours)) costComponent := schema.CostComponent{ Name: "Custom Resolver Locations per Hour", From 68483abf05e8b3adbc8e774e3e10e7d86bbc770a Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 09:57:55 -0400 Subject: [PATCH 08/16] Update unit names for per-hour costs --- internal/resources/ibm/resource_instance_dns-svcs.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index af0c0599db7..1d206dfd8f3 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -73,8 +73,8 @@ func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComp var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolsPerHour) * *r.DNSServices_PoolHours)) costComponent := schema.CostComponent{ - Name: "Pools per Hour", - Unit: "Pools", + Name: "Pool Hours", + Unit: "Hours", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount MonthlyQuantity: quantity, ProductFilter: &schema.ProductFilter{ @@ -98,8 +98,8 @@ func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) *schema.C var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstancesPerHour) * *r.DNSServices_GLBInstanceHours)) costComponent := schema.CostComponent{ - Name: "GLB Instances per Hour", - Unit: "GLB Instances", + Name: "GLB Instance Hours", + Unit: "Hours", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount MonthlyQuantity: quantity, ProductFilter: &schema.ProductFilter{ @@ -148,8 +148,8 @@ func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationsPerHour) * *r.DNSServices_CustomResolverLocationHours)) costComponent := schema.CostComponent{ - Name: "Custom Resolver Locations per Hour", - Unit: "Custom Resolver Locations", + Name: "Custom Resolver Location Hours", + Unit: "Hours", UnitMultiplier: decimal.NewFromFloat(1), // Final quantity for this cost component will be divided by this amount MonthlyQuantity: quantity, ProductFilter: &schema.ProductFilter{ From 12ff6e6327dbf68143118aab7a518125e40fbb79 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 10:01:19 -0400 Subject: [PATCH 09/16] Update golden file --- .../resource_instance_test.golden | 362 +++++++++--------- 1 file changed, 181 insertions(+), 181 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 cfa7afff47c..212f5bd900e 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 @@ -1,185 +1,185 @@ - Name Monthly Qty Unit Monthly Cost - - ibm_resource_instance.cd_instance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.cd_instance_professional - └─ Authorized Users 2 Authorized Users $75.40 - - ibm_resource_instance.dns_svcs_standard - ├─ Additional Zones 1 Zones $0.54 - ├─ Pools per Hour 1 Pools $0.04 - ├─ GLB Instances per Hour 1 GLB Instances $0.04 - ├─ Health Checks 1 Health Checks $1.08 - ├─ Custom Resolver Locations per Hour 1 Custom Resolver Locations $0.13 - ├─ Million Custom Resolver External Queries (first 10 Million Queries) 10 Million Queries $4.31 - ├─ Million Custom Resolver External Queries (over 10 Million Queries) 1 Million Queries $0.22 - └─ Additional Million DNS Queries (first 999 Million Queries) 999 Million Queries $645.16 - └─ Additional Million DNS Queries (over 999 Million Queries) 1 Million Queries $0.32 - - ibm_resource_instance.resource_instance_activity_tracker_7day - └─ Gigabyte Months 10 Gigabyte Months $16.15 - - ibm_resource_instance.resource_instance_activity_tracker_7day_no_usage - └─ Gigabyte Months Monthly cost depends on usage: $1.61 per Gigabyte Months - - ibm_resource_instance.resource_instance_activity_tracker_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.resource_instance_appid - ├─ Users (first 1 Users) 1 Users $0.00 - ├─ Users (next 9 Users) 9 Users $0.02 - ├─ Users (next 90 Users) 90 Users $0.15 - ├─ Users (next 900 Users) 900 Users $1.36 - ├─ Users (next 4000 Users) 0 Users $0.00 - ├─ Users (over 5000 Users) 0 Users $0.00 - ├─ Authentications (first 1 Authentications) 1 Authentications $0.00 - ├─ Authentications (next 9 Authentications) 9 Authentications $0.04 - ├─ Authentications (next 90 Authentications) 90 Authentications $0.30 - ├─ Authentications (next 900 Authentications) 900 Authentications $2.24 - ├─ Authentications (next 4000 Authentications) 4,000 Authentications $6.64 - ├─ Authentications (over 5000 Authentications) 10,000 Authentications $8.29 - └─ Advanced Authentications (first 10 Authentications) 10 Authentications $0.22 - └─ Advanced Authentications (next 99990 Authentications) 19,990 Authentications $429.79 - └─ Advanced Authentications (over 100000 Authentications) 0 Authentications $0.00 - - ibm_resource_instance.resource_instance_kms - ├─ Key versions free allowance (first 5 Key Versions) 5 Key Versions $0.00 - └─ Key versions 295 Key Versions $317.52 - - ibm_resource_instance.resource_instance_logdna_14day - └─ Gigabyte Months (14-day) 1 Gigabyte Months $2.15 - - ibm_resource_instance.resource_instance_logdna_30day - └─ Gigabyte Months (30-day) 1 Gigabyte Months $3.23 - - ibm_resource_instance.resource_instance_logdna_7day - └─ Gigabyte Months (7-day) 1 Gigabyte Months $1.50 - - ibm_resource_instance.resource_instance_logdna_7day_no_usage - └─ Gigabyte Months (7-day) Monthly cost depends on usage: $1.50 per Gigabyte Months - - ibm_resource_instance.resource_instance_logdna_hipaa30day - └─ Gigabyte Months (hipaa-30-day) 1 Gigabyte Months $4.12 - - ibm_resource_instance.resource_instance_logdna_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.resource_instance_monitoring_graduated - ├─ Additional Time series (first 1000 Time series hour) 100 Time series hour $0.01 - ├─ Additional Time series (next 9000 Time series hour) 0 Time series hour $0.00 - ├─ Additional Time series (next 90000 Time series hour) 0 Time series hour $0.00 - ├─ Additional Time series (over 100000 Time series hour) 0 Time series hour $0.00 - ├─ Additional Container Hours 1,460 Container Hours $1.09 - ├─ Additional API Calls 100,000 API Calls $1.08 - └─ Node Hours 730 Node Hours $37.72 - - ibm_resource_instance.resource_instance_monitoring_graduated_no_usage - ├─ Additional Time series (first 1000 Time series hour) Monthly cost depends on usage: $0.0001195944 per Time series hour - ├─ Additional Time series (next 9000 Time series hour) Monthly cost depends on usage: $0.0000747465 per Time series hour - ├─ Additional Time series (next 90000 Time series hour) Monthly cost depends on usage: $0.0000448479 per Time series hour - ├─ Additional Time series (over 100000 Time series hour) Monthly cost depends on usage: $0.0000298986 per Time series hour - ├─ Additional Container Hours Monthly cost depends on usage: $0.0007474653 per Container Hours - ├─ Additional API Calls Monthly cost depends on usage: $0.0000107635 per API Calls - └─ Node Hours Monthly cost depends on usage: $0.0516648 per Node Hours - - ibm_resource_instance.resource_instance_monitoring_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.resource_instance_power_iaas - └─ test 1 Instance $0.00 - - ibm_resource_instance.resource_instance_secrets_manager - ├─ Instance 1 Instance $321.00 - └─ Active Secrets 400 Secrets $86.00 - - ibm_resource_instance.scc_standard - └─ Evaluations 1,000 Evaluations $13.39 - - ibm_resource_instance.scc_trial - └─ Trial 1 $0.00 - - ibm_resource_instance.sccwp_graduated_tier - ├─ Multi-Cloud CSPM Compute Instance Hours (first 25 Instance-Hours) 25 Instance-Hours $206.00 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 25 Instance-Hours) 25 Instance-Hours $175.10 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 50 Instance-Hours) 50 Instance-Hours $309.00 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 150 Instance-Hours) 150 Instance-Hours $865.20 - ├─ Multi-Cloud CSPM Compute Instance Hours (next 250 Instance-Hours) 250 Instance-Hours $1,236.00 - ├─ Multi-Cloud CSPM Compute Instance Hours (over 500 Instance-Hours) 1 Instance-Hours $4.53 - ├─ Node Hours (first 3 Instance-Hours) 3 Instance-Hours $0.19 - ├─ Node Hours (next 2 Instance-Hours) 2 Instance-Hours $0.11 - ├─ Node Hours (next 5 Instance-Hours) 5 Instance-Hours $0.24 - ├─ Node Hours (next 15 Instance-Hours) 15 Instance-Hours $0.68 - ├─ Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.97 - ├─ Node Hours (over 50 Instance-Hours) 1 Instance-Hours $0.04 - └─ VM Node Hours (first 25 Instance-Hours) 25 Instance-Hours $0.56 - └─ VM Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.47 - └─ VM Node Hours (next 50 Instance-Hours) 50 Instance-Hours $0.83 - └─ VM Node Hours (next 150 Instance-Hours) 150 Instance-Hours $2.33 - └─ VM Node Hours (next 250 Instance-Hours) 250 Instance-Hours $3.33 - └─ VM Node Hours (over 500 Instance-Hours) 1 Instance-Hours $0.01 - - ibm_resource_instance.wa_instance_enterprise - ├─ Instance (50000 MAU included) 1 Instance $6,000.00 - ├─ Additional Monthly Active Users 1 1K MAU $120.00 - └─ Monthly Active Users using voice 1 1K MAU $90.00 - - ibm_resource_instance.wa_instance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.wa_instance_plus - ├─ Instance (1000 MAU included) 1 Instance $140.00 - ├─ Additional Monthly Active Users 10 100 MAU $140.00 - └─ Monthly Active Users using voice 1 100 MAU $9.00 - - ibm_resource_instance.wa_instance_trial - └─ Trial 1 $0.00 - - ibm_resource_instance.watson_discovery_enterprise - ├─ Instance 1 Instance $5,000.00 - ├─ Additional Monthly Documents 1,000 Documents $5.00 - ├─ Additional Monthly Queries 1,000 Queries $5.00 - ├─ Additional Monthly Custom Models 1 Custom Models $500.00 - └─ Additional Monthly Collections 1 Hundred Collections $500.00 - - ibm_resource_instance.watson_discovery_plus - ├─ Instance 1 Instance $500.00 - ├─ Additional Monthly Documents 1,000 Documents $50.00 - └─ Additional Monthly Queries 1,000 Queries $20.00 - - ibm_resource_instance.watson_governance_essentials - └─ Resource Units 100 RU $60.00 - - ibm_resource_instance.watson_governance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.watson_governance_standard_v2 - └─ Deployed Models 1 Model $261.00 - - ibm_resource_instance.watson_studio_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.watson_studio_professional - └─ Capacity Unit-Hours 1 CUH $1.02 - - ibm_resource_instance.wml_instance_essentials - ├─ Capacity Unit-Hours 20 CUH $10.40 - ├─ Class 1 Resource Units 50 RU $0.03 - ├─ Class 2 Resource Units 50 RU $0.09 - └─ Class 3 Resource Units 50 RU $0.25 - - ibm_resource_instance.wml_instance_lite - └─ Lite plan 1 $0.00 - - ibm_resource_instance.wml_instance_standard - ├─ Instance (2500 CUH included) 1 Instance $1,050.00 - ├─ Additional Capacity Unit-Hours Monthly cost depends on usage: $0.42 per CUH - ├─ Class 1 Resource Units 50 RU $0.03 - ├─ Class 2 Resource Units 50 RU $0.09 - └─ Class 3 Resource Units 50 RU $0.25 - - OVERALL TOTAL $19,248.98 + Name Monthly Qty Unit Monthly Cost + + ibm_resource_instance.cd_instance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.cd_instance_professional + └─ Authorized Users 2 Authorized Users $75.40 + + ibm_resource_instance.dns_svcs_standard + ├─ Additional Zones 1 Zones $0.54 + ├─ Pool Hours 1 Hours $0.04 + ├─ GLB Instance Hours 1 Hours $0.04 + ├─ Health Checks 1 Health Checks $1.08 + ├─ Custom Resolver Location Hours 1 Hours $0.13 + ├─ Million Custom Resolver External Queries (first 10 Million Queries) 10 Million Queries $4.31 + ├─ Million Custom Resolver External Queries (over 10 Million Queries) 1 Million Queries $0.22 + └─ Additional Million DNS Queries (first 999 Million Queries) 999 Million Queries $645.16 + └─ Additional Million DNS Queries (over 999 Million Queries) 1 Million Queries $0.32 + + ibm_resource_instance.resource_instance_activity_tracker_7day + └─ Gigabyte Months 10 Gigabyte Months $16.15 + + ibm_resource_instance.resource_instance_activity_tracker_7day_no_usage + └─ Gigabyte Months Monthly cost depends on usage: $1.61 per Gigabyte Months + + ibm_resource_instance.resource_instance_activity_tracker_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.resource_instance_appid + ├─ Users (first 1 Users) 1 Users $0.00 + ├─ Users (next 9 Users) 9 Users $0.02 + ├─ Users (next 90 Users) 90 Users $0.15 + ├─ Users (next 900 Users) 900 Users $1.36 + ├─ Users (next 4000 Users) 0 Users $0.00 + ├─ Users (over 5000 Users) 0 Users $0.00 + ├─ Authentications (first 1 Authentications) 1 Authentications $0.00 + ├─ Authentications (next 9 Authentications) 9 Authentications $0.04 + ├─ Authentications (next 90 Authentications) 90 Authentications $0.30 + ├─ Authentications (next 900 Authentications) 900 Authentications $2.24 + ├─ Authentications (next 4000 Authentications) 4,000 Authentications $6.64 + ├─ Authentications (over 5000 Authentications) 10,000 Authentications $8.29 + └─ Advanced Authentications (first 10 Authentications) 10 Authentications $0.22 + └─ Advanced Authentications (next 99990 Authentications) 19,990 Authentications $429.79 + └─ Advanced Authentications (over 100000 Authentications) 0 Authentications $0.00 + + ibm_resource_instance.resource_instance_kms + ├─ Key versions free allowance (first 5 Key Versions) 5 Key Versions $0.00 + └─ Key versions 295 Key Versions $317.52 + + ibm_resource_instance.resource_instance_logdna_14day + └─ Gigabyte Months (14-day) 1 Gigabyte Months $2.15 + + ibm_resource_instance.resource_instance_logdna_30day + └─ Gigabyte Months (30-day) 1 Gigabyte Months $3.23 + + ibm_resource_instance.resource_instance_logdna_7day + └─ Gigabyte Months (7-day) 1 Gigabyte Months $1.50 + + ibm_resource_instance.resource_instance_logdna_7day_no_usage + └─ Gigabyte Months (7-day) Monthly cost depends on usage: $1.50 per Gigabyte Months + + ibm_resource_instance.resource_instance_logdna_hipaa30day + └─ Gigabyte Months (hipaa-30-day) 1 Gigabyte Months $4.12 + + ibm_resource_instance.resource_instance_logdna_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.resource_instance_monitoring_graduated + ├─ Additional Time series (first 1000 Time series hour) 100 Time series hour $0.01 + ├─ Additional Time series (next 9000 Time series hour) 0 Time series hour $0.00 + ├─ Additional Time series (next 90000 Time series hour) 0 Time series hour $0.00 + ├─ Additional Time series (over 100000 Time series hour) 0 Time series hour $0.00 + ├─ Additional Container Hours 1,460 Container Hours $1.09 + ├─ Additional API Calls 100,000 API Calls $1.08 + └─ Node Hours 730 Node Hours $37.72 + + ibm_resource_instance.resource_instance_monitoring_graduated_no_usage + ├─ Additional Time series (first 1000 Time series hour) Monthly cost depends on usage: $0.0001195944 per Time series hour + ├─ Additional Time series (next 9000 Time series hour) Monthly cost depends on usage: $0.0000747465 per Time series hour + ├─ Additional Time series (next 90000 Time series hour) Monthly cost depends on usage: $0.0000448479 per Time series hour + ├─ Additional Time series (over 100000 Time series hour) Monthly cost depends on usage: $0.0000298986 per Time series hour + ├─ Additional Container Hours Monthly cost depends on usage: $0.0007474653 per Container Hours + ├─ Additional API Calls Monthly cost depends on usage: $0.0000107635 per API Calls + └─ Node Hours Monthly cost depends on usage: $0.0516648 per Node Hours + + ibm_resource_instance.resource_instance_monitoring_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.resource_instance_power_iaas + └─ test 1 Instance $0.00 + + ibm_resource_instance.resource_instance_secrets_manager + ├─ Instance 1 Instance $321.00 + └─ Active Secrets 400 Secrets $86.00 + + ibm_resource_instance.scc_standard + └─ Evaluations 1,000 Evaluations $13.39 + + ibm_resource_instance.scc_trial + └─ Trial 1 $0.00 + + ibm_resource_instance.sccwp_graduated_tier + ├─ Multi-Cloud CSPM Compute Instance Hours (first 25 Instance-Hours) 25 Instance-Hours $206.00 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 25 Instance-Hours) 25 Instance-Hours $175.10 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 50 Instance-Hours) 50 Instance-Hours $309.00 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 150 Instance-Hours) 150 Instance-Hours $865.20 + ├─ Multi-Cloud CSPM Compute Instance Hours (next 250 Instance-Hours) 250 Instance-Hours $1,236.00 + ├─ Multi-Cloud CSPM Compute Instance Hours (over 500 Instance-Hours) 1 Instance-Hours $4.53 + ├─ Node Hours (first 3 Instance-Hours) 3 Instance-Hours $0.19 + ├─ Node Hours (next 2 Instance-Hours) 2 Instance-Hours $0.11 + ├─ Node Hours (next 5 Instance-Hours) 5 Instance-Hours $0.24 + ├─ Node Hours (next 15 Instance-Hours) 15 Instance-Hours $0.68 + ├─ Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.97 + ├─ Node Hours (over 50 Instance-Hours) 1 Instance-Hours $0.04 + └─ VM Node Hours (first 25 Instance-Hours) 25 Instance-Hours $0.56 + └─ VM Node Hours (next 25 Instance-Hours) 25 Instance-Hours $0.47 + └─ VM Node Hours (next 50 Instance-Hours) 50 Instance-Hours $0.83 + └─ VM Node Hours (next 150 Instance-Hours) 150 Instance-Hours $2.33 + └─ VM Node Hours (next 250 Instance-Hours) 250 Instance-Hours $3.33 + └─ VM Node Hours (over 500 Instance-Hours) 1 Instance-Hours $0.01 + + ibm_resource_instance.wa_instance_enterprise + ├─ Instance (50000 MAU included) 1 Instance $6,000.00 + ├─ Additional Monthly Active Users 1 1K MAU $120.00 + └─ Monthly Active Users using voice 1 1K MAU $90.00 + + ibm_resource_instance.wa_instance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.wa_instance_plus + ├─ Instance (1000 MAU included) 1 Instance $140.00 + ├─ Additional Monthly Active Users 10 100 MAU $140.00 + └─ Monthly Active Users using voice 1 100 MAU $9.00 + + ibm_resource_instance.wa_instance_trial + └─ Trial 1 $0.00 + + ibm_resource_instance.watson_discovery_enterprise + ├─ Instance 1 Instance $5,000.00 + ├─ Additional Monthly Documents 1,000 Documents $5.00 + ├─ Additional Monthly Queries 1,000 Queries $5.00 + ├─ Additional Monthly Custom Models 1 Custom Models $500.00 + └─ Additional Monthly Collections 1 Hundred Collections $500.00 + + ibm_resource_instance.watson_discovery_plus + ├─ Instance 1 Instance $500.00 + ├─ Additional Monthly Documents 1,000 Documents $50.00 + └─ Additional Monthly Queries 1,000 Queries $20.00 + + ibm_resource_instance.watson_governance_essentials + └─ Resource Units 100 RU $60.00 + + ibm_resource_instance.watson_governance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.watson_governance_standard_v2 + └─ Deployed Models 1 Model $261.00 + + ibm_resource_instance.watson_studio_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.watson_studio_professional + └─ Capacity Unit-Hours 1 CUH $1.02 + + ibm_resource_instance.wml_instance_essentials + ├─ Capacity Unit-Hours 20 CUH $10.40 + ├─ Class 1 Resource Units 50 RU $0.03 + ├─ Class 2 Resource Units 50 RU $0.09 + └─ Class 3 Resource Units 50 RU $0.25 + + ibm_resource_instance.wml_instance_lite + └─ Lite plan 1 $0.00 + + ibm_resource_instance.wml_instance_standard + ├─ Instance (2500 CUH included) 1 Instance $1,050.00 + ├─ Additional Capacity Unit-Hours Monthly cost depends on usage: $0.42 per CUH + ├─ Class 1 Resource Units 50 RU $0.03 + ├─ Class 2 Resource Units 50 RU $0.09 + └─ Class 3 Resource Units 50 RU $0.25 + + OVERALL TOTAL $19,248.98 ────────────────────────────────── 37 cloud resources were detected: ∙ 37 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file \ No newline at end of file From b106f157a2f56ccbf83c5686b57e9a7626bd320a Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 13:35:21 -0400 Subject: [PATCH 10/16] Update usage variable names for uniformity --- infracost-usage-example.yml | 35 +++++++++---------- .../resource_instance_test.usage.yml | 8 ++--- internal/resources/ibm/resource_instance.go | 14 ++++---- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/infracost-usage-example.yml b/infracost-usage-example.yml index dfbb9a30266..08457e68503 100644 --- a/infracost-usage-example.yml +++ b/infracost-usage-example.yml @@ -84,16 +84,16 @@ resource_type_default_usage: sysdig-secure_VM_NODE_HOUR: 501 aiopenscale_RESOURCE_UNITS: 1 aiopenscale_MODELS_PER_MONTH: 1 - dns-svcs_glb_instance_hours: 1 - dns-svcs_pool_hours: 1 - dns-svcs_ITEMS: 2 # Linear; 1 zone included - dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included + dns-svcs_ITEMS: 2 # 1 zone included dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ - dns-svcs_NUMBERGLB: 1 # Linear - dns-svcs_NUMBERHEALTHCHECK: 1 # Linear - dns-svcs_NUMBERPOOLS: 1 # Linear - dns-svcs_RESOLVERLOCATIONS: 1 # Linear - dns-svcs_custom_resolver_location_hours: 1 + dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included + dns-svcs_NUMBERGLB: 1 # Number of GLB HOURS + dns-svcs_NUMBERHEALTHCHECK: 1 + dns-svcs_NUMBERPOOLS: 1 # Number of pool HOURS + dns-svcs_RESOLVERLOCATIONS: 1 # Number of resolver location HOURS + dns-svcs_qty_custom_resolver_locations: 1 # Number of resolver locations + dns-svcs_qty_glb_instances: 1 # Number of GLBs + dns-svcs_qty_pools: 1 # Number of pools ibm_tg_gateway: connection: 3 @@ -1363,16 +1363,15 @@ resource_usage: aiopenscale_MODELS_PER_MONTH: 1 ibm_resource_instance.dns_services: - dns-svcs_ITEMS: 2 - dns-svcs_MILLION_ITEMS: 1001 - dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 - dns-svcs_NUMBERGLB: 1 + dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ + dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included + dns-svcs_NUMBERGLB: 1 # Number of GLB HOURS dns-svcs_NUMBERHEALTHCHECK: 1 - dns-svcs_NUMBERPOOLS: 1 - dns-svcs_RESOLVERLOCATIONS: 1 - dns-svcs_custom_resolver_location_hours: 1 - dns-svcs_glb_instance_hours: 1 - dns-svcs_pool_hours: 1 + dns-svcs_NUMBERPOOLS: 1 # Number of pool HOURS + dns-svcs_RESOLVERLOCATIONS: 1 # Number of resolver location HOURS + dns-svcs_qty_custom_resolver_locations: 1 # Number of resolver locations + dns-svcs_qty_glb_instances: 1 # Number of GLBs + dns-svcs_qty_pools: 1 # Number of pools ibm_tg_gateway.tg_gateway: connection: 25 # Monthly number of connections to the gateway diff --git a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml index 6a1d904de5b..a912854f2d9 100644 --- a/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml +++ b/internal/providers/terraform/ibm/testdata/resource_instance_test/resource_instance_test.usage.yml @@ -100,12 +100,12 @@ resource_usage: ibm_resource_instance.dns_svcs_standard: dns-svcs_ITEMS: 2 # Linear; 1 zone included - dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES: 11 # Tiered; 1-10, 10+ + dns-svcs_MILLION_ITEMS: 1001 # Tiered; 1-999, 999+, 1 included dns-svcs_NUMBERGLB: 1 # Linear dns-svcs_NUMBERHEALTHCHECK: 1 # Linear dns-svcs_NUMBERPOOLS: 1 # Linear dns-svcs_RESOLVERLOCATIONS: 1 # Linear - dns-svcs_custom_resolver_location_hours: 1 - dns-svcs_glb_instance_hours: 1 - dns-svcs_pool_hours: 1 + dns-svcs_qty_custom_resolver_locations: 1 # Number of resolver locations + dns-svcs_qty_glb_instances: 1 # Number of GLBs + dns-svcs_qty_pools: 1 # Number of pools diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 9f25cb406dd..14ed210bbdb 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -87,15 +87,15 @@ type ResourceInstance struct { WGOV_Models *float64 `infracost_usage:"aiopenscale_MODELS_PER_MONTH"` // DNS Services DNSServices_CustomResolverExternalQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES"` - DNSServices_CustomResolverLocationHours *float64 `infracost_usage:"dns-svcs_custom_resolver_location_hours"` DNSServices_CustomResolverLocationsPerHour *int64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` DNSServices_DNSQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS"` - DNSServices_GLBInstanceHours *float64 `infracost_usage:"dns-svcs_glb_instance_hours"` DNSServices_GLBInstancesPerHour *int64 `infracost_usage:"dns-svcs_NUMBERGLB"` DNSServices_HealthChecks *int64 `infracost_usage:"dns-svcs_NUMBERHEALTHCHECK"` - DNSServices_PoolHours *float64 `infracost_usage:"dns-svcs_pool_hours"` DNSServices_PoolsPerHour *int64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"` + DNSServices_CustomResolverLocationHours *float64 `infracost_usage:"dns-svcs_qty_custom_resolver_locations"` + DNSServices_GLBInstanceHours *float64 `infracost_usage:"dns-svcs_qty_glb_instances"` + DNSServices_PoolHours *float64 `infracost_usage:"dns-svcs_qty_pools"` } type ResourceCostComponentsFunc func(*ResourceInstance) []*schema.CostComponent @@ -145,15 +145,15 @@ var ResourceInstanceUsageSchema = []*schema.UsageItem{ {Key: "aiopenscale_RESOURCE_UNITS", DefaultValue: 1, ValueType: schema.Float64}, {Key: "aiopenscale_MODELS_PER_MONTH", DefaultValue: 1, ValueType: schema.Float64}, {Key: "dns-svcs_ITEMS", DefaultValue: 1, ValueType: schema.Int64}, - {Key: "dns-svcs_MILLION_ITEMS", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_MILLION_ITEMS", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_NUMBERGLB", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_NUMBERHEALTHCHECK", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_NUMBERPOOLS", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_RESOLVERLOCATIONS", DefaultValue: 1, ValueType: schema.Int64}, - {Key: "dns-svcs_custom_resolver_location_hours", DefaultValue: 1, ValueType: schema.Int64}, - {Key: "dns-svcs_glb_instance_hours", DefaultValue: 1, ValueType: schema.Int64}, - {Key: "dns-svcs_pool_hours", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_qty_custom_resolver_locations", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_qty_glb_instances", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_qty_pools", DefaultValue: 1, ValueType: schema.Int64}, } var ResourceInstanceCostMap map[string]ResourceCostComponentsFunc = map[string]ResourceCostComponentsFunc{ From 6bbd653a3b6eea84644177cdedca784c6cf2cec4 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 13:42:51 -0400 Subject: [PATCH 11/16] Fix cost component function names --- .../ibm/resource_instance_dns-svcs.go | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 1d206dfd8f3..5244a30b7a0 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -13,13 +13,13 @@ const DNS_SERVICES_PROGRAMMATIC_PLAN_NAME string = "standard-dns" func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { if r.Plan == DNS_SERVICES_PROGRAMMATIC_PLAN_NAME { return []*schema.CostComponent{ - DNSServicesZonesCostComponents(r), - DNSServicesPoolsPerHourCostComponents(r), - DNSServicesGLBInstancesPerHourCostComponents(r), - DNSServicesHealthChecksCostComponents(r), - DNSServicesCustomResolverLocationsPerHourCostComponents(r), - DNSServicesMillionCustomResolverExternalQueriesCostComponents(r), - DNSServicesMillionDNSQueriesCostComponents(r), + DNSServicesZonesCostComponent(r), + DNSServicesPoolsPerHourCostComponent(r), + DNSServicesGLBInstancesPerHourCostComponent(r), + DNSServicesHealthChecksCostComponent(r), + DNSServicesCustomResolverLocationsPerHourCostComponent(r), + DNSServicesMillionCustomResolverExternalQueriesCostComponent(r), + DNSServicesMillionDNSQueriesCostComponent(r), } } else { costComponent := schema.CostComponent{ @@ -35,7 +35,7 @@ func GetDNSServicesCostComponents(r *ResourceInstance) []*schema.CostComponent { } // Unit: ITEMS (Linear Tier) -func DNSServicesZonesCostComponents(r *ResourceInstance) *schema.CostComponent { +func DNSServicesZonesCostComponent(r *ResourceInstance) *schema.CostComponent { var zones_included int = 1 var quantity *decimal.Decimal @@ -68,7 +68,7 @@ func DNSServicesZonesCostComponents(r *ResourceInstance) *schema.CostComponent { } // Unit: NUMBERPOOLS (Linear Tier) -func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { +func DNSServicesPoolsPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolsPerHour) * *r.DNSServices_PoolHours)) @@ -93,7 +93,7 @@ func DNSServicesPoolsPerHourCostComponents(r *ResourceInstance) *schema.CostComp } // Unit: NUMBERGLB (Linear Tier) -func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { +func DNSServicesGLBInstancesPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstancesPerHour) * *r.DNSServices_GLBInstanceHours)) @@ -118,7 +118,7 @@ func DNSServicesGLBInstancesPerHourCostComponents(r *ResourceInstance) *schema.C } // Unit: NUMBERHEALTHCHECK (Linear Tier) -func DNSServicesHealthChecksCostComponents(r *ResourceInstance) *schema.CostComponent { +func DNSServicesHealthChecksCostComponent(r *ResourceInstance) *schema.CostComponent { var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_HealthChecks)) @@ -143,7 +143,7 @@ func DNSServicesHealthChecksCostComponents(r *ResourceInstance) *schema.CostComp } // Unit: RESOLVERLOCATIONS (Linear Tier) -func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance) *schema.CostComponent { +func DNSServicesCustomResolverLocationsPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationsPerHour) * *r.DNSServices_CustomResolverLocationHours)) @@ -168,7 +168,7 @@ func DNSServicesCustomResolverLocationsPerHourCostComponents(r *ResourceInstance } // Unit: MILLION_ITEMS_CREXTERNALQUERIES (Graduated Tier) -func DNSServicesMillionCustomResolverExternalQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { +func DNSServicesMillionCustomResolverExternalQueriesCostComponent(r *ResourceInstance) *schema.CostComponent { var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_CustomResolverExternalQueries)) @@ -193,7 +193,7 @@ func DNSServicesMillionCustomResolverExternalQueriesCostComponents(r *ResourceIn } // Unit: MILLION_ITEMS (Graduated Tier) -func DNSServicesMillionDNSQueriesCostComponents(r *ResourceInstance) *schema.CostComponent { +func DNSServicesMillionDNSQueriesCostComponent(r *ResourceInstance) *schema.CostComponent { var million_dns_queries_included float32 = 1 var quantity *decimal.Decimal From fadf482f09a36fab544e0030631761f81ce4bc38 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 14:43:26 -0400 Subject: [PATCH 12/16] Add nil checks --- .../ibm/resource_instance_dns-svcs.go | 53 +++++++++++++------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 5244a30b7a0..2dc0bb23b43 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -40,11 +40,13 @@ func DNSServicesZonesCostComponent(r *ResourceInstance) *schema.CostComponent { var zones_included int = 1 var quantity *decimal.Decimal - additional_zones := *r.DNSServices_Zones - int64(zones_included) - if additional_zones > 0 { - quantity = decimalPtr(decimal.NewFromInt(additional_zones)) - } else { - quantity = decimalPtr(decimal.NewFromInt(0)) + if r.DNSServices_Zones != nil { + additional_zones := *r.DNSServices_Zones - int64(zones_included) + if additional_zones > 0 { + quantity = decimalPtr(decimal.NewFromInt(additional_zones)) + } else { + quantity = decimalPtr(decimal.NewFromInt(0)) + } } costComponent := schema.CostComponent{ @@ -70,7 +72,11 @@ func DNSServicesZonesCostComponent(r *ResourceInstance) *schema.CostComponent { // Unit: NUMBERPOOLS (Linear Tier) func DNSServicesPoolsPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolsPerHour) * *r.DNSServices_PoolHours)) + var quantity *decimal.Decimal + + if r.DNSServices_PoolsPerHour != nil { + quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolsPerHour) * *r.DNSServices_PoolHours)) + } costComponent := schema.CostComponent{ Name: "Pool Hours", @@ -95,7 +101,11 @@ func DNSServicesPoolsPerHourCostComponent(r *ResourceInstance) *schema.CostCompo // Unit: NUMBERGLB (Linear Tier) func DNSServicesGLBInstancesPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstancesPerHour) * *r.DNSServices_GLBInstanceHours)) + var quantity *decimal.Decimal + + if r.DNSServices_GLBInstancesPerHour != nil { + quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstancesPerHour) * *r.DNSServices_GLBInstanceHours)) + } costComponent := schema.CostComponent{ Name: "GLB Instance Hours", @@ -120,7 +130,11 @@ func DNSServicesGLBInstancesPerHourCostComponent(r *ResourceInstance) *schema.Co // Unit: NUMBERHEALTHCHECK (Linear Tier) func DNSServicesHealthChecksCostComponent(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_HealthChecks)) + var quantity *decimal.Decimal + + if r.DNSServices_HealthChecks != nil { + quantity = decimalPtr(decimal.NewFromInt(*r.DNSServices_HealthChecks)) + } costComponent := schema.CostComponent{ Name: "Health Checks", @@ -145,7 +159,10 @@ func DNSServicesHealthChecksCostComponent(r *ResourceInstance) *schema.CostCompo // Unit: RESOLVERLOCATIONS (Linear Tier) func DNSServicesCustomResolverLocationsPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationsPerHour) * *r.DNSServices_CustomResolverLocationHours)) + var quantity *decimal.Decimal + if r.DNSServices_CustomResolverLocationsPerHour != nil { + quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationsPerHour) * *r.DNSServices_CustomResolverLocationHours)) + } costComponent := schema.CostComponent{ Name: "Custom Resolver Location Hours", @@ -170,7 +187,11 @@ func DNSServicesCustomResolverLocationsPerHourCostComponent(r *ResourceInstance) // Unit: MILLION_ITEMS_CREXTERNALQUERIES (Graduated Tier) func DNSServicesMillionCustomResolverExternalQueriesCostComponent(r *ResourceInstance) *schema.CostComponent { - var quantity *decimal.Decimal = decimalPtr(decimal.NewFromInt(*r.DNSServices_CustomResolverExternalQueries)) + var quantity *decimal.Decimal + + if r.DNSServices_CustomResolverExternalQueries != nil { + quantity = decimalPtr(decimal.NewFromInt(*r.DNSServices_CustomResolverExternalQueries)) + } costComponent := schema.CostComponent{ Name: "Million Custom Resolver External Queries", @@ -198,11 +219,13 @@ func DNSServicesMillionDNSQueriesCostComponent(r *ResourceInstance) *schema.Cost var million_dns_queries_included float32 = 1 var quantity *decimal.Decimal - additional_million_dns_queries := *r.DNSServices_DNSQueries - int64(million_dns_queries_included) - if additional_million_dns_queries > 0 { - quantity = decimalPtr(decimal.NewFromInt(additional_million_dns_queries)) - } else { - quantity = decimalPtr(decimal.NewFromInt(0)) + if r.DNSServices_DNSQueries != nil { + additional_million_dns_queries := *r.DNSServices_DNSQueries - int64(million_dns_queries_included) + if additional_million_dns_queries > 0 { + quantity = decimalPtr(decimal.NewFromInt(additional_million_dns_queries)) + } else { + quantity = decimalPtr(decimal.NewFromInt(0)) + } } costComponent := schema.CostComponent{ From f6dfa92e6ec4cd666f1aa3e48df4999dab782485 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 14:45:45 -0400 Subject: [PATCH 13/16] Update unit variable names --- internal/resources/ibm/resource_instance.go | 20 +++++++++---------- .../ibm/resource_instance_dns-svcs.go | 12 +++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 14ed210bbdb..74d1ff81df3 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -86,16 +86,16 @@ type ResourceInstance struct { WGOV_ru *float64 `infracost_usage:"aiopenscale_RESOURCE_UNITS"` WGOV_Models *float64 `infracost_usage:"aiopenscale_MODELS_PER_MONTH"` // DNS Services - DNSServices_CustomResolverExternalQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES"` - DNSServices_CustomResolverLocationsPerHour *int64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` - DNSServices_DNSQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS"` - DNSServices_GLBInstancesPerHour *int64 `infracost_usage:"dns-svcs_NUMBERGLB"` - DNSServices_HealthChecks *int64 `infracost_usage:"dns-svcs_NUMBERHEALTHCHECK"` - DNSServices_PoolsPerHour *int64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` - DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"` - DNSServices_CustomResolverLocationHours *float64 `infracost_usage:"dns-svcs_qty_custom_resolver_locations"` - DNSServices_GLBInstanceHours *float64 `infracost_usage:"dns-svcs_qty_glb_instances"` - DNSServices_PoolHours *float64 `infracost_usage:"dns-svcs_qty_pools"` + DNSServices_CustomResolverExternalQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES"` + DNSServices_CustomResolverLocationHours *int64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` + DNSServices_CustomResolverLocations *float64 `infracost_usage:"dns-svcs_qty_custom_resolver_locations"` + DNSServices_DNSQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS"` + DNSServices_GLBInstanceHours *int64 `infracost_usage:"dns-svcs_NUMBERGLB"` + DNSServices_GLBInstances *float64 `infracost_usage:"dns-svcs_qty_glb_instances"` + DNSServices_HealthChecks *int64 `infracost_usage:"dns-svcs_NUMBERHEALTHCHECK"` + DNSServices_PoolHours *int64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` + DNSServices_Pools *float64 `infracost_usage:"dns-svcs_qty_pools"` + DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"` } type ResourceCostComponentsFunc func(*ResourceInstance) []*schema.CostComponent diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 2dc0bb23b43..3be258528a3 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -74,8 +74,8 @@ func DNSServicesPoolsPerHourCostComponent(r *ResourceInstance) *schema.CostCompo var quantity *decimal.Decimal - if r.DNSServices_PoolsPerHour != nil { - quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolsPerHour) * *r.DNSServices_PoolHours)) + if r.DNSServices_PoolHours != nil { + quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolHours) * *r.DNSServices_Pools)) } costComponent := schema.CostComponent{ @@ -103,8 +103,8 @@ func DNSServicesGLBInstancesPerHourCostComponent(r *ResourceInstance) *schema.Co var quantity *decimal.Decimal - if r.DNSServices_GLBInstancesPerHour != nil { - quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstancesPerHour) * *r.DNSServices_GLBInstanceHours)) + if r.DNSServices_GLBInstanceHours != nil { + quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstanceHours) * *r.DNSServices_GLBInstances)) } costComponent := schema.CostComponent{ @@ -160,8 +160,8 @@ func DNSServicesHealthChecksCostComponent(r *ResourceInstance) *schema.CostCompo func DNSServicesCustomResolverLocationsPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { var quantity *decimal.Decimal - if r.DNSServices_CustomResolverLocationsPerHour != nil { - quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationsPerHour) * *r.DNSServices_CustomResolverLocationHours)) + if r.DNSServices_CustomResolverLocationHours != nil { + quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationHours) * *r.DNSServices_CustomResolverLocations)) } costComponent := schema.CostComponent{ From 4378775acf635244645078447725b21082390bef Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 15:24:16 -0400 Subject: [PATCH 14/16] Add missing nil checks --- internal/resources/ibm/resource_instance_dns-svcs.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 3be258528a3..957117d51aa 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -74,7 +74,7 @@ func DNSServicesPoolsPerHourCostComponent(r *ResourceInstance) *schema.CostCompo var quantity *decimal.Decimal - if r.DNSServices_PoolHours != nil { + if (r.DNSServices_PoolHours != nil) && (r.DNSServices_Pools != nil) { quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolHours) * *r.DNSServices_Pools)) } @@ -103,7 +103,7 @@ func DNSServicesGLBInstancesPerHourCostComponent(r *ResourceInstance) *schema.Co var quantity *decimal.Decimal - if r.DNSServices_GLBInstanceHours != nil { + if (r.DNSServices_GLBInstanceHours != nil) && (r.DNSServices_GLBInstances != nil) { quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstanceHours) * *r.DNSServices_GLBInstances)) } @@ -160,7 +160,8 @@ func DNSServicesHealthChecksCostComponent(r *ResourceInstance) *schema.CostCompo func DNSServicesCustomResolverLocationsPerHourCostComponent(r *ResourceInstance) *schema.CostComponent { var quantity *decimal.Decimal - if r.DNSServices_CustomResolverLocationHours != nil { + + if (r.DNSServices_CustomResolverLocationHours != nil) && (r.DNSServices_CustomResolverLocations != nil) { quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationHours) * *r.DNSServices_CustomResolverLocations)) } From caee7fcc021741479ad2c56c4209b65735a88286 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 15:35:29 -0400 Subject: [PATCH 15/16] Set hour units to floats --- internal/resources/ibm/resource_instance.go | 12 ++++++------ internal/resources/ibm/resource_instance_dns-svcs.go | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index 74d1ff81df3..d1850f85f42 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -87,14 +87,14 @@ type ResourceInstance struct { WGOV_Models *float64 `infracost_usage:"aiopenscale_MODELS_PER_MONTH"` // DNS Services DNSServices_CustomResolverExternalQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES"` - DNSServices_CustomResolverLocationHours *int64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` - DNSServices_CustomResolverLocations *float64 `infracost_usage:"dns-svcs_qty_custom_resolver_locations"` + DNSServices_CustomResolverLocationHours *float64 `infracost_usage:"dns-svcs_RESOLVERLOCATIONS"` + DNSServices_CustomResolverLocations *int64 `infracost_usage:"dns-svcs_qty_custom_resolver_locations"` DNSServices_DNSQueries *int64 `infracost_usage:"dns-svcs_MILLION_ITEMS"` - DNSServices_GLBInstanceHours *int64 `infracost_usage:"dns-svcs_NUMBERGLB"` - DNSServices_GLBInstances *float64 `infracost_usage:"dns-svcs_qty_glb_instances"` + DNSServices_GLBInstanceHours *float64 `infracost_usage:"dns-svcs_NUMBERGLB"` + DNSServices_GLBInstances *int64 `infracost_usage:"dns-svcs_qty_glb_instances"` DNSServices_HealthChecks *int64 `infracost_usage:"dns-svcs_NUMBERHEALTHCHECK"` - DNSServices_PoolHours *int64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` - DNSServices_Pools *float64 `infracost_usage:"dns-svcs_qty_pools"` + DNSServices_PoolHours *float64 `infracost_usage:"dns-svcs_NUMBERPOOLS"` + DNSServices_Pools *int64 `infracost_usage:"dns-svcs_qty_pools"` DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"` } diff --git a/internal/resources/ibm/resource_instance_dns-svcs.go b/internal/resources/ibm/resource_instance_dns-svcs.go index 957117d51aa..e4cd703e495 100644 --- a/internal/resources/ibm/resource_instance_dns-svcs.go +++ b/internal/resources/ibm/resource_instance_dns-svcs.go @@ -75,7 +75,7 @@ func DNSServicesPoolsPerHourCostComponent(r *ResourceInstance) *schema.CostCompo var quantity *decimal.Decimal if (r.DNSServices_PoolHours != nil) && (r.DNSServices_Pools != nil) { - quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_PoolHours) * *r.DNSServices_Pools)) + quantity = decimalPtr(decimal.NewFromFloat(*r.DNSServices_PoolHours * float64(*r.DNSServices_Pools))) } costComponent := schema.CostComponent{ @@ -104,7 +104,7 @@ func DNSServicesGLBInstancesPerHourCostComponent(r *ResourceInstance) *schema.Co var quantity *decimal.Decimal if (r.DNSServices_GLBInstanceHours != nil) && (r.DNSServices_GLBInstances != nil) { - quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_GLBInstanceHours) * *r.DNSServices_GLBInstances)) + quantity = decimalPtr(decimal.NewFromFloat(*r.DNSServices_GLBInstanceHours * float64(*r.DNSServices_GLBInstances))) } costComponent := schema.CostComponent{ @@ -162,7 +162,7 @@ func DNSServicesCustomResolverLocationsPerHourCostComponent(r *ResourceInstance) var quantity *decimal.Decimal if (r.DNSServices_CustomResolverLocationHours != nil) && (r.DNSServices_CustomResolverLocations != nil) { - quantity = decimalPtr(decimal.NewFromFloat(float64(*r.DNSServices_CustomResolverLocationHours) * *r.DNSServices_CustomResolverLocations)) + quantity = decimalPtr(decimal.NewFromFloat(*r.DNSServices_CustomResolverLocationHours * float64(*r.DNSServices_CustomResolverLocations))) } costComponent := schema.CostComponent{ From 1f660d1973db34196100ed5d4fa774aace9f0189 Mon Sep 17 00:00:00 2001 From: Luisa Rojas Date: Tue, 14 May 2024 16:16:19 -0400 Subject: [PATCH 16/16] Fix int64 -> float64 --- internal/resources/ibm/resource_instance.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/resources/ibm/resource_instance.go b/internal/resources/ibm/resource_instance.go index d1850f85f42..eefcf8e4b07 100644 --- a/internal/resources/ibm/resource_instance.go +++ b/internal/resources/ibm/resource_instance.go @@ -147,10 +147,10 @@ var ResourceInstanceUsageSchema = []*schema.UsageItem{ {Key: "dns-svcs_ITEMS", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_MILLION_ITEMS_CREXTERNALQUERIES", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_MILLION_ITEMS", DefaultValue: 1, ValueType: schema.Int64}, - {Key: "dns-svcs_NUMBERGLB", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_NUMBERGLB", DefaultValue: 1, ValueType: schema.Float64}, {Key: "dns-svcs_NUMBERHEALTHCHECK", DefaultValue: 1, ValueType: schema.Int64}, - {Key: "dns-svcs_NUMBERPOOLS", DefaultValue: 1, ValueType: schema.Int64}, - {Key: "dns-svcs_RESOLVERLOCATIONS", DefaultValue: 1, ValueType: schema.Int64}, + {Key: "dns-svcs_NUMBERPOOLS", DefaultValue: 1, ValueType: schema.Float64}, + {Key: "dns-svcs_RESOLVERLOCATIONS", DefaultValue: 1, ValueType: schema.Float64}, {Key: "dns-svcs_qty_custom_resolver_locations", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_qty_glb_instances", DefaultValue: 1, ValueType: schema.Int64}, {Key: "dns-svcs_qty_pools", DefaultValue: 1, ValueType: schema.Int64},