Hi Guys I am trying to get the usage based cost fo...
# general
b
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 .
Copy code
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.
Copy code
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
b
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.
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
Iam sorry about that . I didn't know . I didn't see that channel . do you want me to remove it?
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 : )
b
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
@busy-agent-35515, does this mean azure doesn't charge disk operations for premium managed disks ? or it's an infracost limitation
azure documentation is not always clear , so I wanted to confirm with you guys
b
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.
Basically, this cost component doesn't apply to them
b
ok , but bear in mind that infracost doesn't know that when creating the usage file
b
Please elaborate. Infracost doesn't create the usage attribute for this resource
b
when say I run the below to generate the usage file
Copy code
infracost breakdown --sync-usage-file --usage-file infracost-usage.yml --path /code
this is what I have in the usage yml :
Copy code
# 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.
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
b
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
exactly , Although It's kinda minor enhancement and you guys are busy but maybe something to consider in future updates
b
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
totally agree
Thank you for the quick reply Vadim. You guys are doing a great job . kudos
b
Thank you for the kind words infraheart Sorry for the confusion!
b
I knew I spoke to you already :D
b
Oh right! Sorry, I didn't recognize your username 😅