Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: Add dimensions argument to consumer quota override #683

Merged
merged 17 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ determining that location is as follows:
| budget\_amount | The amount to use for a budget alert | `number` | `null` | no |
| budget\_display\_name | The display name of the budget. If not set defaults to `Budget For <projects[0]|All Projects>` | `string` | `null` | no |
| budget\_monitoring\_notification\_channels | A list of monitoring notification channels in the form `[projects/{project_id}/notificationChannels/{channel_id}]`. A maximum of 5 channels are allowed. | `list(string)` | `[]` | no |
| consumer\_quotas | The quotas configuration you want to override for the project. | <pre>list(object({<br> service = string,<br> metric = string,<br> limit = string,<br> value = string,<br> }))</pre> | `[]` | no |
| consumer\_quotas | The quotas configuration you want to override for the project. | <pre>list(object({<br> service = string,<br> metric = string,<br> dimensions = object({}),<br> limit = string,<br> value = string,<br> }))</pre> | `[]` | no |
| create\_project\_sa | Whether the default service account for the project shall be created | `bool` | `true` | no |
| default\_network\_tier | Default Network Service Tier for resources created in this project. If unset, the value will not be modified. See https://cloud.google.com/network-tiers/docs/using-network-service-tiers and https://cloud.google.com/network-tiers. | `string` | `""` | no |
| default\_service\_account | Project default service account setting: can be one of `delete`, `deprivilege`, `disable`, or `keep`. | `string` | `"disable"` | no |
Expand Down
18 changes: 10 additions & 8 deletions examples/quota_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ module "project_quota_manager" {
project_id = var.project_id
consumer_quotas = [
{
service = "compute.googleapis.com"
metric = "SimulateMaintenanceEventGroup"
limit = "%2F100s%2Fproject"
value = "19"
service = "compute.googleapis.com"
metric = "SimulateMaintenanceEventGroup"
dimensions = { region = "us-central1" }
limit = "%2F100s%2Fproject"
value = "19"
}, {
service = "servicemanagement.googleapis.com"
metric = "servicemanagement.googleapis.com%2Fdefault_requests"
limit = "%2Fmin%2Fproject"
value = "95"
service = "servicemanagement.googleapis.com"
metric = "servicemanagement.googleapis.com%2Fdefault_requests"
dimensions = {}
limit = "%2Fmin%2Fproject"
value = "95"
}
]
}
2 changes: 1 addition & 1 deletion modules/gsuite_enabled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ The roles granted are specifically:
| budget\_alert\_spent\_percents | A list of percentages of the budget to alert on when threshold is exceeded | `list(number)` | <pre>[<br> 0.5,<br> 0.7,<br> 1<br>]</pre> | no |
| budget\_amount | The amount to use for a budget alert | `number` | `null` | no |
| budget\_monitoring\_notification\_channels | A list of monitoring notification channels in the form `[projects/{project_id}/notificationChannels/{channel_id}]`. A maximum of 5 channels are allowed. | `list(string)` | `[]` | no |
| consumer\_quotas | The quotas configuration you want to override for the project. | <pre>list(object({<br> service = string,<br> metric = string,<br> limit = string,<br> value = string,<br> }))</pre> | `[]` | no |
| consumer\_quotas | The quotas configuration you want to override for the project. | <pre>list(object({<br> service = string,<br> metric = string,<br> dimensions = object({}),<br> limit = string,<br> value = string,<br> }))</pre> | `[]` | no |
| create\_group | Whether to create the group or not | `bool` | `false` | no |
| create\_project\_sa | Whether the default service account for the project shall be created | `bool` | `true` | no |
| default\_network\_tier | Default Network Service Tier for resources created in this project. If unset, the value will not be modified. See https://cloud.google.com/network-tiers/docs/using-network-service-tiers and https://cloud.google.com/network-tiers. | `string` | `""` | no |
Expand Down
9 changes: 5 additions & 4 deletions modules/gsuite_enabled/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ variable "budget_alert_spent_percents" {
variable "consumer_quotas" {
description = "The quotas configuration you want to override for the project."
type = list(object({
service = string,
metric = string,
limit = string,
value = string,
service = string,
metric = string,
dimensions = object({}),
limit = string,
value = string,
}))
default = []
}
Expand Down
4 changes: 3 additions & 1 deletion modules/quota_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ module "project_quota_manager" {
{
service = "compute.googleapis.com"
metric = "SimulateMaintenanceEventGroup"
dimensions = { region = "us-central1" }
limit = "%2F100s%2Fproject"
value = "19"
},{
service = "servicemanagement.googleapis.com"
metric = "servicemanagement.googleapis.com%2Fdefault_requests"
dimensions = {}
limit = "%2Fmin%2Fproject"
value = "95"
}
Expand All @@ -31,7 +33,7 @@ module "project_quota_manager" {

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| consumer\_quotas | The quotas configuration you want to override for the project. | <pre>list(object({<br> service = string,<br> metric = string,<br> limit = string,<br> value = string,<br> }))</pre> | n/a | yes |
| consumer\_quotas | The quotas configuration you want to override for the project. | <pre>list(object({<br> service = string,<br> metric = string,<br> dimensions = object({}),<br> limit = string,<br> value = string,<br> }))</pre> | n/a | yes |
| project\_id | The GCP project where you want to manage the consumer quotas | `string` | n/a | yes |

## Outputs
Expand Down
1 change: 1 addition & 0 deletions modules/quota_manager/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "google_service_usage_consumer_quota_override" "override" {
service = each.value.service
metric = each.value.metric
limit = each.value.limit
dimensions = each.value.dimensions
override_value = each.value.value
force = true
}
9 changes: 5 additions & 4 deletions modules/quota_manager/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ variable "project_id" {
variable "consumer_quotas" {
description = "The quotas configuration you want to override for the project."
type = list(object({
service = string,
metric = string,
limit = string,
value = string,
service = string,
metric = string,
dimensions = object({}),
limit = string,
value = string,
}))
}
9 changes: 5 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,11 @@ variable "grant_services_network_role" {
variable "consumer_quotas" {
description = "The quotas configuration you want to override for the project."
type = list(object({
service = string,
metric = string,
limit = string,
value = string,
service = string,
metric = string,
dimensions = object({}),
limit = string,
value = string,
}))
default = []
}
Expand Down