Skip to content

Resources billed per hour should use hours as unit #104

Open
@Seraf

Description

@Seraf

On the JSON generated by Terracost, some resources like aws_instance are not correctly computed.
The cost result is correct, but there's a miss on quantity and unit attributes:

{
   "planned_cost":"121.336",
   "planned_hourly_cost":"0.166214",
   "prior_cost":"0",
   "prior_hourly_cost":"0",
   "resource_estimates":[
      {
         "address":"module.nexus.aws_instance.nexus",
         "components":[
            {
               "label":"Compute",
               "planned":{
                  "cost":"119.136",
                  "details":[
                     "Linux",
                     "on-demand",
                     "t3a.xlarge"
                  ],
                  "hourly_cost":"0.1632",
                  "quantity":1
               },
               "rate":"119.136"
            },
            {
               "label":"Root volume: Storage",
               "planned":{
                  "cost":"2.2",
                  "details":[
                     "gp2"
                  ],
                  "hourly_cost":"0.003014",
                  "quantity":20
               },
               "rate":"0.11",
               "unit":"GB"
            }
         ],
         "planned_cost":"121.336",
         "planned_hourly_cost":"0.166214",
         "prior_cost":"0",
         "prior_hourly_cost":"0",
         "provider":"aws",
         "type":"aws_instance"
      }
   ],
}

On this example, the rate, quantity and unit should be calculated in terms of hours, using 730 as quantity instead of considering 1 instance as a quantity. Users are not buying an instance, but an amount of hour of an instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions