Skip to content

Commit

Permalink
os cud fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyclenerd committed Feb 18, 2022
1 parent bf42b33 commit 0c32968
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
13 changes: 8 additions & 5 deletions gcosts.pl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Help: https://github.com/Cyclenerd/google-cloud-pricing-cost-calculator

BEGIN {
$VERSION = "1.0.3";
$VERSION = "1.0.4";
}

use strict;
Expand Down Expand Up @@ -739,10 +739,13 @@ sub cost_instances {
$cost_os = '0';
$resource_os = 'vm-os-terminated';
}
if ($commitment == '1') {
$cost_os = &check_commitment_cost($pricing->{'compute'}->{'license'}->{$type}->{'cost'}->{$os}->{'month_1y'}||"compute > license > type '$type' > os '$os'", '1 year', $cost_os, $region);
} elsif ($commitment == '3') {
$cost_os = &check_commitment_cost($pricing->{'compute'}->{'license'}->{$type}->{'cost'}->{$os}->{'month_3y'}||"compute > license > type '$type' > os '$os'", '3 year', $cost_os, $region);
# 2022/02/18: 1y and 3y committed use discounts (CUD) only for SUSE Linux Enterprise Server for SAP (sles-sap)
if ($os eq 'sles-sap') {
if ($commitment == '1') {
$cost_os = &check_commitment_cost($pricing->{'compute'}->{'license'}->{$type}->{'cost'}->{$os}->{'month_1y'}||"compute > license > type '$type' > os '$os'", '1 year', $cost_os, $region);
} elsif ($commitment == '3') {
$cost_os = &check_commitment_cost($pricing->{'compute'}->{'license'}->{$type}->{'cost'}->{$os}->{'month_3y'}||"compute > license > type '$type' > os '$os'", '3 year', $cost_os, $region);
}
}
$cost_os = &add_discount($cost_os, $discount);
&cost(
Expand Down
18 changes: 17 additions & 1 deletion t/01_europe-west4-sap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,20 @@ instances:
- name: bucket-n1-standard-16-sles-sap
class: nearline-dual
region: eur4
data: 1024
data: 1024
- name: n1-standard-16-rhel-sap
type: n1-standard-16
os: rhel-sap
commitment: 3
disks:
- name: disk-n1-standard-16-shel-sap-boot
type: ssd
data: 75
- name: n1-standard-16-windows
type: n1-standard-16
os: windows
commitment: 3
disks:
- name: disk-n1-standard-16-windows-boot
type: ssd
data: 75
7 changes: 7 additions & 0 deletions t/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ MY_CHECKS=(
#
# 01_europe-west4-sap.yml
#
# SLES for SAP (https://cloud.google.com/products/calculator/#id=9a410d62-97b7-4ae0-baba-2f83ba9e625d)
'europe-west4;vm;n1-standard-16-sles-sap;274'
'europe-west4;vm-os;n1-standard-16-sles-sap;107'
'europe-west4;disk;disk-n1-standard-16-sles-sap-boot;14'
'europe-west4;disk;disk-n1-standard-16-sles-sap-data;28'
'europe-west4;disk;snapshot-n1-standard-16-sles-sap-boot;2.9'
'europe-west4;disk;snapshot-n1-standard-16-sles-sap-data;5.8'
'eur4;bucket;bucket-n1-standard-16-sles-sap;20'
# RHEL for SAP (https://cloud.google.com/products/calculator/#id=a41b2496-c124-4db8-9e30-0a5fcfbe9466)
'europe-west4;vm;n1-standard-16-rhel-sap;274'
'europe-west4;vm-os;n1-standard-16-rhel-sap;164'
# Windows (https://cloud.google.com/products/calculator/#id=e23e3861-35f2-4550-9ce4-74585f3d23c1)
'europe-west4;vm;n1-standard-16-windows;274'
'europe-west4;vm-os;n1-standard-16-windows;537'

#
# 01_europe-west4...
Expand Down

0 comments on commit 0c32968

Please sign in to comment.