Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: change consumer quotas variable format to prevent "Duplicate object key" TF Error#1014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
rtb-major wants to merge2 commits intoterraform-google-modules:main
base:main
Choose a base branch
Loading
fromrtb-major:change_consumer_quotas_variable_format

Conversation

@rtb-major
Copy link

This is abreaking change as it changes the way TF sees it's resources.

The reason of this change is simple, currently when you create a config of consumer_quotas like this:

    {      service = "bigquery.googleapis.com"      metric  = urlencode("bigquery.googleapis.com/quota/query/usage")      limit   = urlencode("/d/project")      dimensions = {}      value = "100000"    },    {      service = "bigquery.googleapis.com"      metric  = urlencode("bigquery.googleapis.com/quota/query/usage")      limit   = urlencode("/d/project/user")      dimensions = {}      value = "100000"    }    ]

So you want to override quota both for project and project/user limit, then after you runterrafrom plan you get an error:

  │ Error: Duplicate object key  │   │   on .terraform/modules/projects/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.

This change fixes this issue and potentially other similar when you want to set up different limit for same quota/metric.

Proposed change is to change variable name from "quota-metric" value to "metric-limit" not for "qouta-metric-limit" as metric always consists of quota value plus quota name, ie:
quota = "bigquery.googleapis.com"
metric = "bigquery.googleapis.com%2Fquota%2Fquery%2Fusage"

@rtb-majorrtb-major requested review froma team andimrannayer ascode ownersOctober 27, 2025 07:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@imrannayerimrannayerAwaiting requested review from imrannayerimrannayer is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@rtb-major

[8]ページ先頭

©2009-2025 Movatter.jp