Title
#general
b

brokedba

11/18/2022, 7:26 AM
Hi Guys I am trying to get the usage based cost for azure managed disks but it doesn't seem to calculate the cost from an array based resources .
version: 0.1
resource_usage:
  azurerm_managed_disk.DATA[0]:        
    monthly_disk_operations: 100000000 
  ....
result using the usal file . anything created using a index isn't considered although I saw no warning.
Name                                              Monthly Qty  Unit            Monthly Cost (CAD)

 azurerm_linux_virtual_machine.curavm
 ├─ Instance usage (pay as you go, Standard_M8ms)          750  hours                    $1,693.75
 └─ os_disk
    ├─ Storage (S4)                                          1  months                       $2.26
    └─ Disk operations                                  10,000  10k operations               $6.68

 azurerm_managed_disk.BIN
 ├─ Storage (S10)                                            1  months                       $8.65
 └─ Disk operations                                     10,000  10k operations               $6.68

 azurerm_managed_disk.DATA[0]
 └─ Storage (P20)                                            1  months                      $97.83
...etc
Vadim (Infracost)

Vadim (Infracost)

11/18/2022, 9:40 AM
Hello! Could you please provide an example TF code so I can try to reproduce it? From your output snippet I see disk operations for the
curavm
resource, however
DATA[0]
is clipped, I assume it doesn't list the Disk operations cost.
9:41 AM
Also, we're trying to reserve this channel for announcements now. We created a dedicated #help channel to keep the topics separate and make the channel less noisy for the community 🙂
b

brokedba

11/18/2022, 5:34 PM
Iam sorry about that . I didn't know . I didn't see that channel . do you want me to remove it?
5:37 PM
this is it . maybe the disk resource doesn't have a disk ops rate or it's just because of the array I have 5 elements? please let me know I have to remove this thread from here : )
Vadim (Infracost)

Vadim (Infracost)

11/20/2022, 4:23 PM
Thank you for providing the example! No worries on removing the messages, all is good 😃 I tried to replicate this and indeed, the Storage operations cost component was not shown. You are correct, the disk operations don't apply for "Premium_LRS" (P20) disk type. We add this component only for "Standard_LRS" and "StandardSSD_LRS". Here are for your reference:1. GH issue with details: https://github.com/infracost/infracost/issues/567 2. Code: https://github.com/infracost/infracost/blob/master/internal/providers/terraform/azure/managed_disk.go#L130
b

brokedba

11/22/2022, 7:16 PM
@Vadim (Infracost), does this mean azure doesn't charge disk operations for premium managed disks ? or it's an infracost limitation
7:16 PM
azure documentation is not always clear , so I wanted to confirm with you guys
Vadim (Infracost)

Vadim (Infracost)

11/22/2022, 7:26 PM
Good question. If I understand this page correctly https://azure.microsoft.com/en-us/pricing/details/managed-disks/#pricing. the disk operations (like read/write) are not accounted for premium disks.
The total cost of Premium SSDs depends on the size and number of the disks, and will be affected by the number of outbound data transfers.
7:27 PM
Basically, this cost component doesn't apply to them
b

brokedba

11/22/2022, 7:28 PM
ok , but bear in mind that infracost doesn't know that when creating the usage file
Vadim (Infracost)

Vadim (Infracost)

11/22/2022, 7:29 PM
Please elaborate. Infracost doesn't create the usage attribute for this resource
b

brokedba

11/22/2022, 7:29 PM
when say I run the below to generate the usage file
infracost breakdown --sync-usage-file --usage-file infracost-usage.yml --path /code
this is what I have in the usage yml :
# resource_usage:
  ##
  ## The following usage values apply to individual resources and override any value defined in the resource_type_default_usage section.
  ## All values are commented-out, you can uncomment resources and customize as needed.
  ##
  # azurerm_managed_disk.DATA[0]:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_managed_disk.DATA[1]:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_managed_disk.DATA[2]:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_managed_disk.DATA[3]:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_managed_disk.DATA[4]:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_managed_disk.RECO[0]:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_managed_disk.RECO[1]:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_linux_virtual_machine.curavm:
    # monthly_hrs: 0 # Monthly number of hours the instance ran for.
    # os_disk:
      # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
  # azurerm_managed_disk.BIN:
    # monthly_disk_operations: 0 # Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
7:32 PM
I now know I should ignore disk operation usage for those premium disks since you informed me . but the confusion(in the first place) came from the usage template created based on my tf files through
--sync-usage-file --usage-file
Vadim (Infracost)

Vadim (Infracost)

11/22/2022, 7:34 PM
Yeah, I see how this can be confusing. Currently, the only type of documentation for the usage values are the comments like
# Number of disk operations (writes, reads, deletes) using a unit size of 256KiB.
I think the easiest fix would be updating this comment to mention something like "Applies only for standard managed disks"
b

brokedba

11/22/2022, 7:36 PM
exactly , Although It's kinda minor enhancement and you guys are busy but maybe something to consider in future updates
Vadim (Infracost)

Vadim (Infracost)

11/22/2022, 7:36 PM
We don't use the Azure Cloud ourselves, so we also rely on users and community to add the missing details, as they are experts with the providers they use.
b

brokedba

11/22/2022, 7:37 PM
totally agree
7:45 PM
Thank you for the quick reply Vadim. You guys are doing a great job . kudos
Vadim (Infracost)

Vadim (Infracost)

11/22/2022, 7:46 PM
Thank you for the kind words :infraheart: Sorry for the confusion!