Cloud Services

Enterprise Marketplace

Pricing for Terraform templates
Published On Oct 07, 2024 - 11:29 AM

Pricing for Terraform templates

Create a rate card to provide pricing for services onboarded using Terraform templates.
To have pricing information for catalogs in Enterprise Marketplace Catalog, you need to create a rate card for each of them. These rate cards take the form of comma-separated value (CSV) files. For more information about the parameters needed, see Rate card formatting. After you have created your rate card, upload it to the system using an API. For more information, see Create rate card.
The order of fetching rate-card is serviceId → serviceGroup → Resource type. In other words, the system will first check if the rate-card is present for a particular catalog. If it is, the system will fetch the price from that rate card. If the rate card is not found for that catalog, it will look for the catalog group rate card and fetch the price from that, and then finally resource type.

Managing rate cards

The APIs in this section can be used to manage your rate cards:
This section assumes that you have already created your rate card CSV files. If you have not, see Rate card formatting.

Create rate card

Converts a rate CSV file into a rate card:
  • Method:
    POST
  • API:
    /price/ratecard/ratecards
  • Parameters:
    • file:
      (required) Upload the rate CSV file that you want to turn into a rate card.

Update rate card

Updates a rate card using the indicated rate CSV file:
  • Method:
    PUT
  • API:
    /price/ratecard/ratecards/{rc_id}
  • Parameters:
    • file:
      (required) Upload the rate CSV file that you want to turn into a rate card.
    • rc_id:
      (required) The ID of the rate card you want to update.

Fetch rate card ID

Fetches the IDs of rate cards based on the parameters set. If you do not supply any parameters, all rate card IDs are listed.
  • Method:
    GET
  • API:
    /ratecard/ratecards
  • Parameters:
    • short:
      If set to
      true
      , the query returns only the ID and name of the rate card.
    • offset:
      Remove this many results from the start of the list. The default is 0.
    • limit:
      Limit the number of results on each page to this amount. The default is 20.
    • sort_order:
      Sets whether to sort in
      asc
      (ascending) or
      desc
      (descending) order.
    • sort_by:
      Select the parameter type that you want to sort by.

Patch rate card

Patches a rate card identified by ID with the contents of the file provided.
  • Method:
    PATCH
  • API:
    {host}/price/ratecard/ratecards/{rc_id}
  • Parameters:
    • file:
      (required) Upload the rate CSV file that you want to turn into a rate card.
    • action:
      Select the type of update action that you are performing. The selections are
      set
      (the default),
      pull
      , and
      push
      .
    • rc_id:
      (required) The ID of the rate card you want to update.

Delete rate card

Deletes the rate card identified by the supplied ID.
  • Method:
    DELETE
  • API:
    {host}/price/ratecard/ratecards/{rc_id}
  • Parameters:
    • rc_id:
      (required) The ID of the rate card you want to update.

Rate card formatting

The format of a rate card CSV file depends on the type of rate card that you want to create:
  • Resource type rate card: Supports dynamic and static pricing based on the type of Terraform resources provisioned.
  • Service based rate card: Supports dynamic and static pricing based on the attributes of the services provisioned.
  • Service group based rate card: Supports dynamic and static pricing based on the attributes of the services provisioned. Instead of serviceId, you use serviceGroupId inside the CSV.

Resource type rate card

This type of rate card CSV file supports dynamic and static pricing based on the type of Terraform resources that are being provisioned. The estimated price for the catalog is calculated by the number and type of resources being provisioned. Multiple Terraform resource types can be contained in a single CSV file.
Guidelines
Keep in mind the following hints for resource type rate cards:
  • The Resource Type should match the Terraform resource type.
  • The Resource Type based pricing depends on the attributes in the Terraform resource type. Therefore, the variables inside the expression should match the attributes inside the Terraform resource type.
  • If the rate is static and does not depend on any resource attribute, the expression value can be set as
    TRUE
    .
  • If there are multiple attributes with the same name, include the JSON path of that attribute in the expression.
Schema
These attributes need to be set for resource type rate cards:
  • Resource Type:
    (required) The unique ID of the resource type. Multiple Terraform resource types entries can be added in a single rate card.
  • Region:
    The geographic location of the Terraform resource being configured.
  • SKU Name:
    (required) A unique identifier for the rate card item.
  • SKU Description:
    Further description of the rate card item, if desired. If this description is supplied, it will be listed in the bill of materials - lineitem. Otherwise, the description in the bill of materials will be formed using the
    SKU Name
    and
    Region
    .
  • Expression:
    (required) This is a string expression/condition that determines whether the item is picked if the evaluated expression is true. For example,
    storage_account_type == Standard_LRS and disk_size_gb >= 32 and disk_size_gb < 65
    . Here
    storage_account_type
    and
    disk_size_gb
    are the attributes of the resource managed_disk. Multiple expressions can be combined with the "and" operator. The supported comparison operators are "==", "<=", ">=", "<", ">". If the rate is static and does not depend on any resource attribute, set the expression value to
    TRUE
    .
  • Unit Of Measure:
    (required) Sets the interval at which the price is charged. If the unit is "Hours" or "Month", or "Day" or "1 Hour", it is considered a Recurring charge. Units like "1/Month" or "GB/Month" are considered Usage charges.
  • Rate:
    (required) Provides the rate/price for the rate item when the expression condition is satisfied. Float value is supported.
  • Tier Config:
    A Terraform resource attribute can be provided for which you want to calculate price based on tier. The rate will be multiplied by the resource attribute value to generate the final price. For example,
    node_count
    is the attribute for the resource
    kubernetes_cluster_node_pool
    that determines how many nodes will be created in the pool. If this attribute is selected in
    tier Config
    , the final price will be the rate multiplied by node_count value.
Example
The following is an example of a resource type rate card.
resource "vsphere_virtual_machine" "vm" { name = "foo" resource_pool_id = data.vsphere_compute_cluster.cluster.resource_pool_id datastore_id = data.vsphere_datastore.datastore.id num_cpus = 1 memory = 1024 guest_id = "other3xLinux64Guest" network_interface { network_id = data.vsphere_network.network.id } disk { label = "disk0" size = 20 } }
The following are the parameters used in the example.
Resource Type
SKU Name
SKU Description
Expression
Unit of Measure
Rate
google_compute_instance
Compute Engine
f1-micro machine Asia-East1
machine_type==f1-micro
1/Month
2.33
google_compute_instance
Compute Engine Boot
f1-micro machine with Boot size
machine_type==f1-micro and boot_disk[0].initialize_params[0].size<=30
1/Month
4

Service based rate card

The service based rate card supports static and dynamic pricing based on configuration values.
Guidelines
Keep in mind the following hints when creating a service based dynamic rate card:
  • The serviceId should match with serviceId of the catalog/catalog groupId of the catalog.
  • The service-based pricing is totally depend on the variables inside the Terraform template. Therefore, the variables inside the expression should match the variables inside the Terraform template.
  • Multiple serviceIds can be added in a single CSV file.
  • If the rate is static and does not depend on any variable, set the expression value as
    TRUE
    .
Schema
These attributes need to be set for service-based dynamic rate cards:
  • Service Id:
    (required) The unique ID of the catalog.
  • Region:
    The geographic location of the Terraform resource being configured.
  • SKU Name:
    (required) A unique identifier for the rate card item.
  • SKU Description:
    Further description of the rate card item, if desired. If this description is supplied, it will be listed in the bill of materials - lineitem. Otherwise, the description in the bill of materials will be formed using the
    SKU Name
    and
    Region
    .
  • Expression:
    (required) This is a string expression/condition that determines whether the item is picked if the evaluated expression is true. For example,
    storage_account_type == Standard_LRS and disk_size_gb >= 32 and disk_size_gb < 65
    . Here
    storage_account_type
    and
    disk_size_gb
    are the attributes of the resource managed_disk. Multiple expressions can be combined with the "and" operator. The supported comparison operators are "==", "<=", ">=", "<", ">". If the rate is static and does not depend on any resource attribute, set the expression value to
    TRUE
    .
  • Unit Of Measure:
    (required) Sets the interval at which the price is charged. If the unit is "Hours" or "Month", or "Day" or "1 Hour", it is considered a Recurring charge. Units like "1/Month" or "GB/Month" are considered Usage charges.
  • Rate:
    (required) Provides the rate/price for the rate item when the expression condition is satisfied. Float value is supported.
  • Tier Config:
    The confid Id for which you want to calculate price based on tier. The rate will be multiplied by the config value to generate the final price. For example,
    memory
    is the config id of catalog
    dC77kMbTm2fErYcfaR2Q3d
    that tells you how memory is assigned. Therefore, the final price will be the rate multiplied by the
    memory
    value. In addition, operation multiplication and division operations are supported for conversions. For example, memory/1024 will convert the memory value from MB to GB.
Examples
An example of a service-based dynamic rate card can be found at https://drive.google.com/file/d/1agpmEMxEt3pcG2Mwwvj7xTUxE6rg9Jzs/view?usp=sharing.
This example includes the following parameters:
Service Group
Region
SKU Name
SKU Description
Expression
Unit of Measure
Rate
Tier Config
4SVH5mpD9YFiienhgwXSiD
eastus
Disk1
Disk size less than 30
size<=30
GB/Month
0
size
4SVH5mpD9YFiienhgwXSiD
eastus
Disk2
Disk size greater than 30
size>=31
GB/Month
0.3
size
An example of a service-based static rate card can be found at https://drive.google.com/file/d/1agpmEMxEt3pcG2Mwwvj7xTUxE6rg9Jzs/view?usp=sharing.
This example includes the following parameters:
Service Group
Region
SKU Name
SKU Description
Expression
Unit of Measure
Rate
4SVH5mpD9YFiienhgwXSiD
eastus
Disk1
Disk size less than 30
TRUE
GB/Month
5
4SVH5mpD9YFiienhgwXSiD
eastus
Disk2
Disk size greater than 30
TRUE
GB/Month
10

Service group based rate card

The service-group-based rate card supports dynamic and static pricing based on the attributes of the services provisioned. Instead of serviceId, you must use serviceGroupId inside the CSV.
Guidelines
Keep in mind the following hints when creating a service based dynamic rate card:
  • The Service Group should match with the catalog groupId.
  • The service-based pricing is totally depend on the variables inside the Terraform template. Therefore, the variables inside the expression should match the variables inside the Terraform template.
  • If the rate is static and does not depend on any variable, set the expression value as
    TRUE
    .
Schema
These attributes need to be set for service-group-based rate cards:
  • Service Group:
    (required) The unique ID of the service group.
  • Region:
    The geographic location of the Terraform resource being configured.
  • SKU Name:
    (required) A unique identifier for the rate card item.
  • SKU Description:
    Further description of the rate card item, if desired. If this description is supplied, it will be listed in the bill of materials - lineitem. Otherwise, the description in the bill of materials will be formed using the
    SKU Name
    and
    Region
    .
  • Expression:
    (required) This is a string expression/condition that determines whether the item is picked if the evaluated expression is true. For example,
    storage_account_type == Standard_LRS and disk_size_gb >= 32 and disk_size_gb < 65
    . Here
    storage_account_type
    and
    disk_size_gb
    are the attributes of the resource managed_disk. Multiple expressions can be combined with the "and" operator. The supported comparison operators are "==", "<=", ">=", "<", ">". If the rate is static and does not depend on any resource attribute, set the expression value to
    TRUE
    .
  • Unit Of Measure:
    (required) Sets the interval at which the price is charged. If the unit is "Hours" or "Month", or "Day" or "1 Hour", it is considered a Recurring charge. Units like "1/Month" or "GB/Month" are considered Usage charges.
  • Rate:
    (required) Provides the rate/price for the rate item when the expression condition is satisfied. Float value is supported.
  • Tier Config:
    The confid Id for which you want to calculate price based on tier. The rate will be multiplied by the config value to generate the final price. For example,
    memory
    is the config id of catalog
    dC77kMbTm2fErYcfaR2Q3d
    that tells you how memory is assigned. Therefore, the final price will be the rate multiplied by the
    memory
    value. In addition, operation multiplication and division operations are supported for conversions. For example, memory/1024 will convert the memory value from MB to GB.
Do you have two minutes for a quick survey?
Take Survey