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:
resource "google_compute_region_commitment" "foobar" {
name = "my-region-commitment"
plan = "THIRTY_SIX_MONTH"
resources {
type = "VCPU"
amount = "4"
}
resources {
type = "MEMORY"
amount = "9"
}
}
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"
}
}
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.
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.
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.
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.
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.
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.This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.delete
- Default is 20 minutes.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 to import RegionCommitment using one of the formats above. For example:
import {
id = "projects/{{project}}/regions/{{region}}/commitments/{{name}}"
to = google_compute_region_commitment.default
}
When using the terraform import
command, 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}}
This resource supports User Project Overrides.