GetTerraformPricingMappings
Retrieves the pricing mapping catalog in batches by Terraform resource type for cost estimation during the RunIaC plan phase.
Operation description
Retrieves mappings between schema attributes in the Terraform alicloud provider and OpenAPI parameters.
Try it now
Test
RAM authorization
Request syntax
POST /api/v1/price/terraform-mappings HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body: The resourceTypes field specifies a list of Terraform resource types, such as alicloud_instance. You can specify up to 200 resource types per request. |
{ "resourceTypes": [ "alicloud_instance", "alicloud_vpc" ] } |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response schema. |
||
| schemaVersion |
string |
The schema version of the mapping catalog. The current version is 1.0. Consumers use this version to determine compatibility. |
1.0 |
| mappingVersion |
string |
The content version of the mapping, which is the timestamp of the most recent data change. Consumers use this version for caching and auditing. |
1786000000000 |
| mappings |
array<object> |
The list of matched mappings. Each item contains the resourceType and pricingTargets fields. The pricingTargets field includes pricing targets and parameter extraction rules. Within the rules, $after and $before reference the resource attributes in the Terraform plan. |
|
|
array<object> |
The pricing mapping for a single resource type. |
||
| resourceType |
string |
The Terraform resource type, such as alicloud_instance. |
alicloud_instance |
| pricingTargets |
array<object> |
The list of pricing targets. Each item contains the actions (create or update), popCode, popVersion, apiName, pricingUnit, params, and when or whenChanged conditions. The params field defines parameter extraction rules, such as from=$after.xxx, const, default, or expand. |
|
|
object |
A single pricing target. It includes the API triplet and parameter extraction rules required for a pricing call. |
{"actions":["create"],"popCode":"Ecs","popVersion":"2014-05-26","apiName":"RunInstances","params":{"InstanceType":{"from":"$after.instance_type"}}} |
|
| missingResourceTypes |
array |
The resource types in the request that do not have registered mappings. Consumers must treat these resource types as having unknown costs and must not treat them as free. |
|
|
string |
A Terraform resource type for which no mapping is registered. Its cost is unknown and must not be treated as zero. |
alicloud_brand_new |
|
| unsupportedResourceTypes |
array |
The resource types that are confirmed not to support price inquiries, such as resources that are free of charge or have no pricing API. These differ from the resource types listed in missingResourceTypes. |
|
|
string |
A Terraform resource type that is confirmed to have no pricing API, such as a resource that is free of charge. |
alicloud_security_group |
|
| requestId |
string |
The request ID. |
1AF0AD89-ED4F-5E9E-8B7B-9A3B27CE9E1B |
Examples
Success response
JSON format
{
"schemaVersion": "1.0",
"mappingVersion": "1786000000000",
"mappings": [
{
"resourceType": "alicloud_instance",
"pricingTargets": [
{
"actions": [
"create"
],
"popCode": "Ecs",
"popVersion": "2014-05-26",
"apiName": "RunInstances",
"params": {
"InstanceType": {
"from": "$after.instance_type"
}
}
}
]
}
],
"missingResourceTypes": [
"alicloud_brand_new"
],
"unsupportedResourceTypes": [
"alicloud_security_group"
],
"requestId": "1AF0AD89-ED4F-5E9E-8B7B-9A3B27CE9E1B"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.