Skip to content

Commit

Permalink
fix database core variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Koo committed May 8, 2024
1 parent 53941a2 commit d1d89b0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,21 @@
└─ Disk (first 1 GB-DISK) 1 GB-DISK $0.61
└─ Disk (over 0 GB-DISK) 1 GB-DISK $0.63

OVERALL TOTAL $87.45
ibm_database.test_es_enterprise_db1
├─ RAM (first 1 GB-RAM) 1 GB-RAM $15.70
├─ RAM (over 0 GB-RAM) 1 GB-RAM $16.17
├─ Disk (first 1 GB-DISK) 1 GB-DISK $0.61
├─ Disk (over 0 GB-DISK) 1 GB-DISK $0.63
└─ Core (first 1 Virtual Processor Core) 1 Virtual Processor Core $31.40
└─ Core (over 0 Virtual Processor Core) 1 Virtual Processor Core $32.34

ibm_database.test_es_enterprise_db2
├─ RAM (first 1 GB-RAM) 1 GB-RAM $15.70
├─ RAM (over 0 GB-RAM) 1 GB-RAM $16.17
└─ Disk (first 1 GB-DISK) 1 GB-DISK $0.61
└─ Disk (over 0 GB-DISK) 1 GB-DISK $0.63

OVERALL TOTAL $217.41
──────────────────────────────────
2 cloud resources were detected:
2 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file
4 cloud resources were detected:
4 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file
12 changes: 6 additions & 6 deletions internal/resources/ibm/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ type Database struct {
// Pricing Link: https://cloud.ibm.com/docs/databases-for-postgresql?topic=databases-for-postgresql-pricing
postgresql_RAM *int64 `infracost_usage:"postgresql_database_ram_mb"`
postgresql_Disk *int64 `infracost_usage:"postgresql_database_disk_mb"`
postgresql_Core *int64 `infracost_usage:"postgresql_database_core"`
Core_postgresql *int64 `infracost_usage:"postgresql_database_core"`
postgresql_Members *int64 `infracost_usage:"postgresql_database_members"`

elasticsearch_RAM *int64 `infracost_usage:"elasticsearch_database_ram_mb"`
elasticsearch_Disk *int64 `infracost_usage:"elasticsearch_database_disk_mb"`
elasticsearch_Core *int64 `infracost_usage:"elasticsearch_database_core"`
Core_elasticsearch *int64 `infracost_usage:"elasticsearch_database_core"`
elasticsearch_Members *int64 `infracost_usage:"elasticsearch_database_members"`
}

Expand Down Expand Up @@ -138,8 +138,8 @@ func PostgresDiskCostComponent(r *Database) *schema.CostComponent {

func PostgresCoreCostComponent(r *Database) *schema.CostComponent {
var c decimal.Decimal
if r.postgresql_Core != nil {
c = decimal.NewFromInt(*r.postgresql_Core)
if r.Core_postgresql != nil {
c = decimal.NewFromInt(*r.Core_postgresql)
} else { // set the default
c = decimal.NewFromInt(0)
}
Expand Down Expand Up @@ -297,8 +297,8 @@ func ElasticSearchDiskCostComponent(r *Database) *schema.CostComponent {

func ElasticSearchCoreCostComponent(r *Database) *schema.CostComponent {
var c decimal.Decimal
if r.elasticsearch_Core != nil {
c = decimal.NewFromInt(*r.elasticsearch_Core)
if r.Core_elasticsearch != nil {
c = decimal.NewFromInt(*r.Core_elasticsearch)
} else { // set the default
c = decimal.NewFromInt(0)
}
Expand Down

0 comments on commit d1d89b0

Please sign in to comment.