Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support for DNS Services #178

Merged
merged 18 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions infracost-usage-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ resource_type_default_usage:
sysdig-secure_VM_NODE_HOUR: 501
aiopenscale_RESOURCE_UNITS: 1
aiopenscale_MODELS_PER_MONTH: 1
dns-svcs_ITEMS: 2 # 1 zone 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 # 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
data_transfer_global: 1000
Expand Down Expand Up @@ -1351,6 +1362,17 @@ resource_usage:
ibm_resource_instance.watson_governance_standard_v2:
aiopenscale_MODELS_PER_MONTH: 1

ibm_resource_instance.dns_services:
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 # 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
data_transfer_local: 2500 # Monthly local traffic through the gateway in GB
Expand Down
1 change: 1 addition & 0 deletions internal/providers/terraform/ibm/ibm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
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

Expand Down Expand Up @@ -168,7 +179,7 @@
├─ Class 2 Resource Units 50 RU $0.09
└─ Class 3 Resource Units 50 RU $0.25

OVERALL TOTAL $18,597.15
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
37 cloud resources were detected:
37 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -97,3 +97,15 @@ resource_usage:

ibm_resource_instance.watson_governance_standard_v2:
aiopenscale_MODELS_PER_MONTH: 1

ibm_resource_instance.dns_svcs_standard:
dns-svcs_ITEMS: 2 # Linear; 1 zone 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_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
22 changes: 22 additions & 0 deletions internal/resources/ibm/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ 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_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 *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 *float64 `infracost_usage:"dns-svcs_NUMBERPOOLS"`
DNSServices_Pools *int64 `infracost_usage:"dns-svcs_qty_pools"`
DNSServices_Zones *int64 `infracost_usage:"dns-svcs_ITEMS"`
}

type ResourceCostComponentsFunc func(*ResourceInstance) []*schema.CostComponent
Expand Down Expand Up @@ -133,6 +144,16 @@ 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_CREXTERNALQUERIES", DefaultValue: 1, ValueType: schema.Int64},
{Key: "dns-svcs_MILLION_ITEMS", 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.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},
}

var ResourceInstanceCostMap map[string]ResourceCostComponentsFunc = map[string]ResourceCostComponentsFunc{
Expand All @@ -152,6 +173,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 {
Expand Down
Loading
Loading