Skip to content

Commit

Permalink
add missing tiers to pi volumes (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiltol authored Sep 18, 2024
1 parent 34b5ff9 commit 665f431
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@

Name Monthly Qty Unit Monthly Cost

ibm_pi_volume.pi_volume_affinity_set
└─ Volume (100 GB, example-volume) Price dependent on affinity settings 73,000 Gigabyte Instance Hours $0.00

ibm_pi_volume.pi_volume_tier1
└─ Volume (100 GB, tier1, example-volume) 73,000 Gigabyte Instance Hours $20.00

ibm_pi_volume.pi_volume_tier1_no_usage
└─ Volume (100 GB, tier1, example-volume) Monthly cost depends on usage: $0.000274 per Gigabyte Instance Hours

ibm_pi_volume.pi_volume_tier3
└─ Volume (100 GB, tier3, example-volume) 73,000 Gigabyte Instance Hours $10.45

ibm_pi_volume.pi_volume_volume_set
└─ Volume pool (100 GB, example-volume) Price dependent on volume pool settings 73,000 Gigabyte Instance Hours $0.00

ibm_resource_instance.powervs_service
└─ Power instance 1 Instance $0.00

OVERALL TOTAL $30.45
Name Monthly Qty Unit Monthly Cost

ibm_pi_volume.pi_volume_affinity_set
└─ Volume (100 GB, affinity-volume-set) Price dependent on affinity settings 73,000 Gigabyte Instance Hours $0.00

ibm_pi_volume.pi_volume_tier0
└─ Volume (100 GB, tier0, tier0-volume) 73,000 Gigabyte Instance Hours $0.00

ibm_pi_volume.pi_volume_tier0_no_usage
└─ Volume (100 GB, tier0, tier0-volume2) Monthly cost depends on usage: $0.00 per Gigabyte Instance Hours

ibm_pi_volume.pi_volume_tier1
└─ Volume (100 GB, tier1, tier1-volume) 73,000 Gigabyte Instance Hours $20.00

ibm_pi_volume.pi_volume_tier1_no_usage
└─ Volume (100 GB, tier1, tier1-volume2) Monthly cost depends on usage: $0.000274 per Gigabyte Instance Hours

ibm_pi_volume.pi_volume_tier3
└─ Volume (100 GB, tier3, tier3-volume) 73,000 Gigabyte Instance Hours $10.45

ibm_pi_volume.pi_volume_tier3_no_usage
└─ Volume (100 GB, tier3, tier3-volume2) Monthly cost depends on usage: $0.000143165 per Gigabyte Instance Hours

ibm_pi_volume.pi_volume_tier5k
└─ Volume (100 GB, tier5k, tier5k-volume) 73,000 Gigabyte Instance Hours $0.00

ibm_pi_volume.pi_volume_tier5k_no_usage
└─ Volume (100 GB, tier5k, tier5k-volume2) Monthly cost depends on usage: $0.00 per Gigabyte Instance Hours

ibm_pi_volume.pi_volume_volume_set
└─ Volume pool (100 GB, volume-pool) Price dependent on volume pool settings 73,000 Gigabyte Instance Hours $0.00

ibm_resource_instance.powervs_service
└─ Power instance 1 Instance $0.00

OVERALL TOTAL $30.45
──────────────────────────────────
9 cloud resources were detected:
8 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file
12 cloud resources were detected:
11 were estimated, all of which include usage-based costs, see https://infracost.io/usage-file
∙ 1 was free:
∙ 1 x ibm_resource_group
Original file line number Diff line number Diff line change
Expand Up @@ -23,57 +23,81 @@ resource "ibm_resource_instance" "powervs_service" {
}

resource "ibm_pi_volume" "pi_volume_affinity_set" {
pi_volume_name = "example-volume"
pi_volume_name = "affinity-volume-set"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_affinity_policy = "affinity"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_volume_set" {
pi_volume_name = "example-volume"
pi_volume_name = "volume-pool"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_pool = "volume-pool-name"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier0" {
pi_volume_name = "example-volume"
pi_volume_name = "tier0-volume"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier0"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier1" {
pi_volume_name = "example-volume"
pi_volume_name = "tier1-volume"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier1"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier3" {
pi_volume_name = "example-volume"
pi_volume_name = "tier3-volume"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier3"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier5k" {
pi_volume_name = "example-volume"
pi_volume_name = "tier5k-volume"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier5k"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier0_no_usage" {
pi_volume_name = "tier0-volume2"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier0"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier1_no_usage" {
pi_volume_name = "example-volume"
pi_volume_name = "tier1-volume2"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier1"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier3_no_usage" {
pi_volume_name = "tier3-volume2"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier3"
pi_volume_shareable = false
}

resource "ibm_pi_volume" "pi_volume_tier5k_no_usage" {
pi_volume_name = "tier5k-volume2"
pi_cloud_instance_id = ibm_resource_instance.powervs_service.guid
pi_volume_size = 100
pi_volume_type = "tier5k"
pi_volume_shareable = false
}
4 changes: 3 additions & 1 deletion internal/resources/ibm/ibm_pi_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ var IbmPiVolumeUsageSchema = []*schema.UsageItem{
}

var tierMapping = map[string]string{
"tier0": "TIER_ZERO_STORAGE_GIGABYTE_HOURS",
"tier1": "TIER_ONE_STORAGE_GIGABYTE_HOURS",
"ssd": "TIER_ONE_STORAGE_GIGABYTE_HOURS",
"tier3": "TIER_THREE_STORAGE_GIGABYTE_HOURS",
"tier5k": "FIXED_5K_OPS_GIGABYTE_HOURS",
"standard": "TIER_THREE_STORAGE_GIGABYTE_HOURS",
}

Expand Down Expand Up @@ -103,7 +105,7 @@ func (r *IbmPiVolume) BuildResource() *schema.Resource {
}
costComponent.SetCustomPrice(decimalPtr(decimal.NewFromInt(0.0)))
costComponents = append(costComponents, costComponent)
} else if r.Type == "tier1" || r.Type == "tier3" || r.Type == "standard" || r.Type == "ssd" {
} else if r.Type == "tier1" || r.Type == "tier3" || r.Type == "standard" || r.Type == "ssd" || r.Type == "tier0" || r.Type == "tier5k" {

costComponent := &schema.CostComponent{
Name: fmt.Sprintf("Volume (%d GB, %s, %s)", r.Size, r.Type, r.Name),
Expand Down

0 comments on commit 665f431

Please sign in to comment.