blob: d2680e0951c60e1913e3e8727d90a728aaf78709 [file] [log] [blame] [edit]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "BigQuery Reservation"
description: |-
Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some committed period of usage.
---
# google_bigquery_capacity_commitment
Capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of slots) with some committed period of usage. Annual commitments renew by default. Commitments can be removed after their commitment end time passes.
In order to remove annual commitment, its plan needs to be changed to monthly or flex first.
To get more information about CapacityCommitment, see:
* [API documentation](https://cloud.google.com/bigquery/docs/reference/reservations/rest/v1/projects.locations.capacityCommitments)
* How-to Guides
* [Introduction to Reservations](https://cloud.google.com/bigquery/docs/reservations-intro)
## Example Usage - Bigquery Reservation Capacity Commitment Docs
```hcl
resource "google_bigquery_capacity_commitment" "example" {
capacity_commitment_id = "example-commitment"
location = "us-west2"
slot_count = 100
plan = "FLEX_FLAT_RATE"
edition = "ENTERPRISE"
}
```
## Argument Reference
The following arguments are supported:
* `slot_count` -
(Required)
Number of slots in this commitment.
* `plan` -
(Required)
Capacity commitment plan. Valid values are at https://cloud.google.com/bigquery/docs/reference/reservations/rpc/google.cloud.bigquery.reservation.v1#commitmentplan
- - -
* `renewal_plan` -
(Optional)
The plan this capacity commitment is converted to after commitmentEndTime passes. Once the plan is changed, committed period is extended according to commitment plan. Only applicable for some commitment plans.
* `edition` -
(Optional)
The edition type. Valid values are STANDARD, ENTERPRISE, ENTERPRISE_PLUS
* `capacity_commitment_id` -
(Optional)
The optional capacity commitment ID. Capacity commitment name will be generated automatically if this field is
empty. This field must only contain lower case alphanumeric characters or dashes. The first and last character
cannot be a dash. Max length is 64 characters. NOTE: this ID won't be kept if the capacity commitment is split
or merged.
* `location` -
(Optional)
The geographic location where the transfer config should reside.
Examples: US, EU, asia-northeast1. The default value is US.
* `enforce_single_admin_project_per_org` -
(Optional)
If true, fail the request if another project in the organization has a capacity commitment.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `{{name}}`
* `name` -
The resource name of the capacity commitment, e.g., projects/myproject/locations/US/capacityCommitments/123
* `state` -
State of the commitment
* `commitment_start_time` -
The start of the current commitment period. It is applicable only for ACTIVE capacity commitments.
* `commitment_end_time` -
The start of the current commitment period. It is applicable only for ACTIVE capacity commitments.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
CapacityCommitment can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}`
* `{{project}}/{{location}}/{{capacity_commitment_id}}`
* `{{location}}/{{capacity_commitment_id}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import CapacityCommitment using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}"
to = google_bigquery_capacity_commitment.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), CapacityCommitment can be imported using one of the formats above. For example:
```
$ terraform import google_bigquery_capacity_commitment.default projects/{{project}}/locations/{{location}}/capacityCommitments/{{capacity_commitment_id}}
$ terraform import google_bigquery_capacity_commitment.default {{project}}/{{location}}/{{capacity_commitment_id}}
$ terraform import google_bigquery_capacity_commitment.default {{location}}/{{capacity_commitment_id}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).