The hmacKeys resource represents an HMAC key within Cloud Storage. The resource consists of a secret and HMAC key metadata. HMAC keys can be used as credentials for service accounts.
To get more information about HmacKey, see:
# Create a new service account
resource "google_service_account" "service_account" {
account_id = "my-svc-acc"
}
#Create the HMAC key for the associated service account
resource "google_storage_hmac_key" "key" {
service_account_email = google_service_account.service_account.email
}
The following arguments are supported:
service_account_email
-
(Required)
The email address of the key's associated service account.state
-
(Optional)
The state of the key. Can be set to one of ACTIVE, INACTIVE.
Default value is ACTIVE
.
Possible values are: ACTIVE
, INACTIVE
.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/hmacKeys/{{access_id}}
secret
-
HMAC secret key material.
Note: This property is sensitive and will not be displayed in the plan.
access_id
-
The access ID of the HMAC Key.
time_created
-
'The creation time of the HMAC key in RFC 3339 format. '
updated
-
'The last modification time of the HMAC key metadata in RFC 3339 format.'
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.HmacKey can be imported using any of these accepted formats:
projects/{{project}}/hmacKeys/{{access_id}}
{{project}}/{{access_id}}
{{access_id}}
In Terraform v1.5.0 and later, use an import
block to import HmacKey using one of the formats above. For example:
import {
id = "projects/{{project}}/hmacKeys/{{access_id}}"
to = google_storage_hmac_key.default
}
When using the terraform import
command, HmacKey can be imported using one of the formats above. For example:
$ terraform import google_storage_hmac_key.default projects/{{project}}/hmacKeys/{{access_id}}
$ terraform import google_storage_hmac_key.default {{project}}/{{access_id}}
$ terraform import google_storage_hmac_key.default {{access_id}}
This resource supports User Project Overrides.