blob: 8cb5f0bb649d8c84e5cff140fcc29515b1db3bf0 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** 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: "Compute Engine"
description: |-
Represents a regional Commitment resource.
---
# google\_compute\_region\_commitment
Represents a regional Commitment resource.
Creating a commitment resource means that you are purchasing a committed
use contract with an explicit start and end time. You can create commitments
based on vCPUs and memory usage and receive discounted rates.
To get more information about RegionCommitment, see:
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/regionCommitments)
* How-to Guides
* [Committed use discounts for Compute Engine](https://cloud.google.com/compute/docs/instances/committed-use-discounts-overview)
## Example Usage - Compute Region Commitment Basic
```hcl
resource "google_compute_region_commitment" "foobar" {
name = "my-region-commitment"
plan = "THIRTY_SIX_MONTH"
resources {
type = "VCPU"
amount = "4"
}
resources {
type = "MEMORY"
amount = "9"
}
}
```
## Example Usage - Compute Region Commitment Full
```hcl
resource "google_compute_region_commitment" "foobar" {
name = "my-full-commitment"
description = "some description"
plan = "THIRTY_SIX_MONTH"
type = "MEMORY_OPTIMIZED"
category = "MACHINE"
auto_renew = true
resources {
type = "VCPU"
amount = "4"
}
resources {
type = "MEMORY"
amount = "9"
}
}
```
## Argument Reference
The following arguments are supported:
* `name` -
(Required)
Name of the resource. The name must be 1-63 characters long and match
the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the
first character must be a lowercase letter, and all following
characters must be a dash, lowercase letter, or digit, except the last
character, which cannot be a dash.
* `plan` -
(Required)
The plan for this commitment, which determines duration and discount rate.
The currently supported plans are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years).
Possible values are: `TWELVE_MONTH`, `THIRTY_SIX_MONTH`.
- - -
* `description` -
(Optional)
An optional description of this resource.
* `resources` -
(Optional)
A list of commitment amounts for particular resources.
Note that VCPU and MEMORY resource commitments must occur together.
Structure is [documented below](#nested_resources).
* `type` -
(Optional)
The type of commitment, which affects the discount rate and the eligible resources.
The type could be one of the following value: `MEMORY_OPTIMIZED`, `ACCELERATOR_OPTIMIZED`,
`GENERAL_PURPOSE_N1`, `GENERAL_PURPOSE_N2`, `GENERAL_PURPOSE_N2D`, `GENERAL_PURPOSE_E2`,
`GENERAL_PURPOSE_T2D`, `GENERAL_PURPOSE_C3`, `COMPUTE_OPTIMIZED_C2`, `COMPUTE_OPTIMIZED_C2D` and
`GRAPHICS_OPTIMIZED_G2`
* `category` -
(Optional)
The category of the commitment. Category MACHINE specifies commitments composed of
machine resources such as VCPU or MEMORY, listed in resources. Category LICENSE
specifies commitments composed of software licenses, listed in licenseResources.
Note that only MACHINE commitments should have a Type specified.
Possible values are: `LICENSE`, `MACHINE`.
* `license_resource` -
(Optional)
The license specification required as part of a license commitment.
Structure is [documented below](#nested_license_resource).
* `auto_renew` -
(Optional)
Specifies whether to enable automatic renewal for the commitment.
The default value is false if not specified.
If the field is set to true, the commitment will be automatically renewed for either
one or three years according to the terms of the existing commitment.
* `region` -
(Optional)
URL of the region where this commitment may be used.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
<a name="nested_resources"></a>The `resources` block supports:
* `type` -
(Optional)
Type of resource for which this commitment applies.
Possible values are VCPU, MEMORY, LOCAL_SSD, and ACCELERATOR.
* `amount` -
(Optional)
The amount of the resource purchased (in a type-dependent unit,
such as bytes). For vCPUs, this can just be an integer. For memory,
this must be provided in MB. Memory must be a multiple of 256 MB,
with up to 6.5GB of memory per every vCPU.
* `accelerator_type` -
(Optional)
Name of the accelerator type resource. Applicable only when the type is ACCELERATOR.
<a name="nested_license_resource"></a>The `license_resource` block supports:
* `license` -
(Required)
Any applicable license URI.
* `amount` -
(Optional)
The number of licenses purchased.
* `cores_per_license` -
(Optional)
Specifies the core range of the instance for which this license applies.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `projects/{{project}}/regions/{{region}}/commitments/{{name}}`
* `commitment_id` -
Unique identifier for the resource.
* `creation_timestamp` -
Creation timestamp in RFC3339 text format.
* `status` -
Status of the commitment with regards to eventual expiration
(each commitment has an end date defined).
* `status_message` -
A human-readable explanation of the status.
* `start_timestamp` -
Commitment start time in RFC3339 text format.
* `end_timestamp` -
Commitment end time in RFC3339 text format.
* `self_link` - The URI of the created resource.
## 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.
- `delete` - Default is 20 minutes.
## Import
RegionCommitment can be imported using any of these accepted formats:
* `projects/{{project}}/regions/{{region}}/commitments/{{name}}`
* `{{project}}/{{region}}/{{name}}`
* `{{region}}/{{name}}`
* `{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import RegionCommitment using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/regions/{{region}}/commitments/{{name}}"
to = google_compute_region_commitment.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), RegionCommitment can be imported using one of the formats above. For example:
```
$ terraform import google_compute_region_commitment.default projects/{{project}}/regions/{{region}}/commitments/{{name}}
$ terraform import google_compute_region_commitment.default {{project}}/{{region}}/{{name}}
$ terraform import google_compute_region_commitment.default {{region}}/{{name}}
$ terraform import google_compute_region_commitment.default {{name}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).