consumer_quotas = [
{
service = "bigquery.googleapis.com"
metric = urlencode("bigquery.googleapis.com/quota/query/usage")
limit = urlencode("/d/project")
value = "2097152"
dimensions = {}
},
{
service = "bigquery.googleapis.com"
metric = urlencode("bigquery.googleapis.com/quota/query/usage")
limit = urlencode("/d/project/user")
value = "2097152"
dimensions = {}
},
]
I get this error:
│ Error: Duplicate object key
│
│ on .terraform/modules/data-pipelines/modules/quota_manager/main.tf line 18, in locals:
│ 18: consumer_quotas = { for index, quota in var.consumer_quotas : "${quota.service}-${quota.metric}" => quota }
│ ├────────────────
│ │ quota.metric is "bigquery.googleapis.com%2Fquota%2Fquery%2Fusage"
│ │ quota.service is "bigquery.googleapis.com"
│
│ Two different items produced the key "bigquery.googleapis.com-bigquery.googleapis.com%2Fquota%2Fquery%2Fusage" in this 'for' expression. If duplicates are expected, use the ellipsis (...) after the value expression to enable grouping by key.
The map consumer_quotas is built using the service and metric to create a unique name, but since the Quotas Query usage per day per user and Query usage per share the same metric (bigquery.googleapis.com/quota/query/usage) I am unable to add both.
locals {
consumer_quotas = { for index, quota in var.consumer_quotas : "${quota.service}-${quota.metric}" => quota }
}
Expected behavior
Two quota resources get created
Observed behavior
User
│ Error: Duplicate object key
│
│ on .terraform/modules/data-pipelines/modules/quota_manager/main.tf line 18, in locals:
│ 18: consumer_quotas = { for index, quota in var.consumer_quotas : "${quota.service}-${quota.metric}" => quota }
│ ├────────────────
│ │ quota.metric is "bigquery.googleapis.com%2Fquota%2Fquery%2Fusage"
│ │ quota.service is "bigquery.googleapis.com"
│
│ Two different items produced the key "bigquery.googleapis.com-bigquery.googleapis.com%2Fquota%2Fquery%2Fusage" in this 'for' expression. If duplicates are expected, use the ellipsis (...) after the value expression to enable grouping by key.
TL;DR
Trying to add the following
consumer_quotas
:I get this error:
The map
consumer_quotas
is built using the service and metric to create a unique name, but since the QuotasQuery usage per day per user
andQuery usage per
share the same metric (bigquery.googleapis.com/quota/query/usage
) I am unable to add both.Expected behavior
Two quota resources get created
Observed behavior
Terraform Configuration
Additional information
No response