google_storage_hmac_key

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:

Open in Cloud Shell

Example Usage - Storage Hmac Key

# 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
}

Argument Reference

The following arguments are supported:


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

HmacKey can be imported using any of these accepted formats:

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}}

User Project Overrides

This resource supports User Project Overrides.