blob: 835dd41dab69e478a0a0ca4089a670f97782bfa6 [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: "Cloud Storage"
description: |-
The hmacKeys resource represents an HMAC key within Cloud Storage.
---
# 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:
* [API documentation](https://cloud.google.com/storage/docs/json_api/v1/projects/hmacKeys)
* How-to Guides
* [Official Documentation](https://cloud.google.com/storage/docs/authentication/managing-hmackeys)
~> **Warning:** All arguments including the `secret` value will be stored in the raw
state as plain-text. [Read more about sensitive data in state](https://www.terraform.io/language/state/sensitive-data).
On import, the `secret` value will not be retrieved.
~> **Warning:** All arguments including the following potentially sensitive
values will be stored in the raw state as plain text: `secret`.
[Read more about sensitive data in state](https://www.terraform.io/language/state/sensitive-data).
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=storage_hmac_key&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Storage Hmac Key
```hcl
# 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:
* `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.
## 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}}/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.'
## 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
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](https://developer.hashicorp.com/terraform/language/import) to import HmacKey using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/hmacKeys/{{access_id}}"
to = google_storage_hmac_key.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).