|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "datadog_custom_allocation_rule Resource - terraform-provider-datadog" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + Provides a Datadog Custom Allocation Rule resource. Custom allocation rules allow you to allocate cloud costs based on tags and filters. |
| 7 | +--- |
| 8 | + |
| 9 | +# datadog_custom_allocation_rule (Resource) |
| 10 | + |
| 11 | +Provides a Datadog Custom Allocation Rule resource. Custom allocation rules allow you to allocate cloud costs based on tags and filters. |
| 12 | + |
| 13 | +## Example Usage |
| 14 | + |
| 15 | +```terraform |
| 16 | +# Create new datadog_custom_allocation_rule resource |
| 17 | +
|
| 18 | +resource "datadog_custom_allocation_rule" "my_allocation_rule" { |
| 19 | + costs_to_allocate { |
| 20 | + condition = "is" |
| 21 | + tag = "aws_product" |
| 22 | + value = "ec2" |
| 23 | + } |
| 24 | + enabled = true |
| 25 | + providernames = ["aws"] |
| 26 | + rule_name = "my-allocation-rule" |
| 27 | + strategy { |
| 28 | + allocated_by_tag_keys = ["team"] |
| 29 | + based_on_costs { |
| 30 | + condition = "is" |
| 31 | + tag = "env" |
| 32 | + value = "prod" |
| 33 | + } |
| 34 | + granularity = "daily" |
| 35 | + method = "even" |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +<!-- schema generated by tfplugindocs --> |
| 41 | +## Schema |
| 42 | + |
| 43 | +### Required |
| 44 | + |
| 45 | +- `enabled` (Boolean) Whether the custom allocation rule is enabled. |
| 46 | +- `providernames` (List of String) List of cloud providers the rule applies to. Valid values include `aws`, `azure`, and `gcp`. |
| 47 | +- `rule_name` (String) The name of the custom allocation rule. This field is immutable - changing it will force replacement of the resource. |
| 48 | + |
| 49 | +### Optional |
| 50 | + |
| 51 | +- `costs_to_allocate` (Block List) (see [below for nested schema](#nestedblock--costs_to_allocate)) |
| 52 | +- `strategy` (Block, Optional) (see [below for nested schema](#nestedblock--strategy)) |
| 53 | + |
| 54 | +### Read-Only |
| 55 | + |
| 56 | +- `created` (String) The timestamp (in ISO 8601 format) when the rule was created. |
| 57 | +- `id` (String) The ID of this resource. |
| 58 | +- `last_modified_user_uuid` (String) The UUID of the user who last modified the rule. |
| 59 | +- `order_id` (Number) The order of the rule in the list of custom allocation rules. This field is read-only. Use the `datadog_custom_allocation_rules` resource to manage rule order. |
| 60 | +- `rejected` (Boolean) Whether the rule was rejected by the API during creation due to validation errors. This field is read-only. |
| 61 | +- `updated` (String) The timestamp (in ISO 8601 format) when the rule was last updated. |
| 62 | +- `version` (Number) The version number of the rule. This increments each time the rule is updated. |
| 63 | + |
| 64 | +<a id="nestedblock--costs_to_allocate"></a> |
| 65 | +### Nested Schema for `costs_to_allocate` |
| 66 | + |
| 67 | +Optional: |
| 68 | + |
| 69 | +- `condition` (String) The condition to match. Valid values are `=`, `!=`, `is`, `is not`, `like`, `in`, `not in`. |
| 70 | +- `tag` (String) The tag key to filter on (e.g., `aws_product`, `team`, `environment`). |
| 71 | +- `value` (String) The single tag value to match. Use this field for conditions like `=`, `!=`, `is`, `is not`, `like`. Do not use with `in` or `not in` conditions. |
| 72 | +- `values` (List of String) A list of tag values to match. Use this field for `in` or `not in` conditions only. Do not use with single-value conditions. |
| 73 | + |
| 74 | + |
| 75 | +<a id="nestedblock--strategy"></a> |
| 76 | +### Nested Schema for `strategy` |
| 77 | + |
| 78 | +Optional: |
| 79 | + |
| 80 | +- `allocated_by` (Block List) (see [below for nested schema](#nestedblock--strategy--allocated_by)) |
| 81 | +- `allocated_by_filters` (Block List) (see [below for nested schema](#nestedblock--strategy--allocated_by_filters)) |
| 82 | +- `allocated_by_tag_keys` (List of String) List of tag keys used to allocate costs (e.g., `["team", "project"]`). Costs will be distributed across unique values of these tags. |
| 83 | +- `based_on_costs` (Block List) (see [below for nested schema](#nestedblock--strategy--based_on_costs)) |
| 84 | +- `based_on_timeseries` (Block, Optional) (see [below for nested schema](#nestedblock--strategy--based_on_timeseries)) |
| 85 | +- `evaluate_grouped_by_filters` (Block List) (see [below for nested schema](#nestedblock--strategy--evaluate_grouped_by_filters)) |
| 86 | +- `evaluate_grouped_by_tag_keys` (List of String) List of tag keys used to group costs before allocation. Costs are grouped by these tag values before applying the allocation strategy. |
| 87 | +- `granularity` (String) The granularity level for cost allocation. Valid values are `daily` or `monthly`. |
| 88 | +- `method` (String) The allocation method. Valid values are `even`, `proportional`, `proportional_timeseries`, or `percent`. |
| 89 | + |
| 90 | +<a id="nestedblock--strategy--allocated_by"></a> |
| 91 | +### Nested Schema for `strategy.allocated_by` |
| 92 | + |
| 93 | +Optional: |
| 94 | + |
| 95 | +- `allocated_tags` (Block List) (see [below for nested schema](#nestedblock--strategy--allocated_by--allocated_tags)) |
| 96 | +- `percentage` (Number) The percentage of costs to allocate to this target as a decimal (e.g., 0.33 for 33%). Used when `method` is `percent`. |
| 97 | + |
| 98 | +<a id="nestedblock--strategy--allocated_by--allocated_tags"></a> |
| 99 | +### Nested Schema for `strategy.allocated_by.allocated_tags` |
| 100 | + |
| 101 | +Optional: |
| 102 | + |
| 103 | +- `key` (String) The tag key to allocate costs to (e.g., `team`, `environment`). |
| 104 | +- `value` (String) The tag value to allocate costs to (e.g., `backend`, `production`). |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +<a id="nestedblock--strategy--allocated_by_filters"></a> |
| 109 | +### Nested Schema for `strategy.allocated_by_filters` |
| 110 | + |
| 111 | +Optional: |
| 112 | + |
| 113 | +- `condition` (String) The condition to match. Valid values are `=`, `!=`, `is`, `is not`, `like`, `in`, `not in`. |
| 114 | +- `tag` (String) The tag key to filter on for allocation targets. |
| 115 | +- `value` (String) The single tag value to match for allocation. Use with conditions like `=`, `!=`, `is`, `is not`, `like`. |
| 116 | +- `values` (List of String) A list of tag values to match for allocation. Use with `in` or `not in` conditions. |
| 117 | + |
| 118 | + |
| 119 | +<a id="nestedblock--strategy--based_on_costs"></a> |
| 120 | +### Nested Schema for `strategy.based_on_costs` |
| 121 | + |
| 122 | +Optional: |
| 123 | + |
| 124 | +- `condition` (String) The condition to match. Valid values are `=`, `!=`, `is`, `is not`, `like`, `in`, `not in`. |
| 125 | +- `tag` (String) The tag key to use as the basis for cost allocation calculations. |
| 126 | +- `value` (String) The single tag value to use for cost calculations. Use with conditions like `=`, `!=`, `is`, `is not`, `like`. |
| 127 | +- `values` (List of String) A list of tag values to use for cost calculations. Use with `in` or `not in` conditions. |
| 128 | + |
| 129 | + |
| 130 | +<a id="nestedblock--strategy--based_on_timeseries"></a> |
| 131 | +### Nested Schema for `strategy.based_on_timeseries` |
| 132 | + |
| 133 | + |
| 134 | +<a id="nestedblock--strategy--evaluate_grouped_by_filters"></a> |
| 135 | +### Nested Schema for `strategy.evaluate_grouped_by_filters` |
| 136 | + |
| 137 | +Optional: |
| 138 | + |
| 139 | +- `condition` (String) The condition to match. Valid values are `=`, `!=`, `is`, `is not`, `like`, `in`, `not in`. |
| 140 | +- `tag` (String) The tag key to filter on when grouping costs for evaluation. |
| 141 | +- `value` (String) The single tag value to match when grouping. Use with conditions like `=`, `!=`, `is`, `is not`, `like`. |
| 142 | +- `values` (List of String) A list of tag values to match when grouping. Use with `in` or `not in` conditions. |
| 143 | + |
| 144 | +## Import |
| 145 | + |
| 146 | +Import is supported using the following syntax: |
| 147 | + |
| 148 | +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: |
| 149 | + |
| 150 | +```shell |
| 151 | +terraform import datadog_custom_allocation_rule.new_list <rule_id> |
| 152 | +``` |
0 commit comments