2017-11-23 19:26:43 +00:00
---
layout: "google"
page_title: "Google: google_kms_crypto_key_iam_binding"
sidebar_current: "docs-google-kms-crypto-key-iam-binding"
description: |-
Allows management of a single binding with an IAM policy for a Google Cloud KMS crypto key
---
# google\_kms\_crypto\_key\_iam\_binding
Allows creation and management of a single binding within IAM policy for
an existing Google Cloud KMS crypto key.
2019-01-04 23:30:22 +00:00
~> **Note:** On create, this resource will overwrite members of any existing roles.
Use `terraform import` and inspect the `terraform plan` output to ensure
your existing members are preserved.
2017-11-23 19:26:43 +00:00
## Example Usage
```hcl
2018-01-31 17:35:52 +00:00
resource "google_kms_crypto_key_iam_binding" "crypto_key" {
2018-05-22 19:48:20 +00:00
crypto_key_id = "my-gcp-project/us-central1/my-key-ring/my-crypto-key"
2017-11-23 19:26:43 +00:00
role = "roles/editor"
members = [
2019-01-04 23:30:22 +00:00
"user:alice@gmail.com",
2017-11-23 19:26:43 +00:00
]
}
```
## Argument Reference
The following arguments are supported:
2019-01-04 23:30:22 +00:00
* `members` - (Required) A list of users that the role should apply to. For more details on format and restrictions see https://cloud.google.com/billing/reference/rest/v1/Policy#Binding
2017-11-23 19:26:43 +00:00
* `role` - (Required) The role that should be applied. Only one
2018-01-22 23:34:17 +00:00
`google_kms_crypto_key_iam_binding` can be used per role. Note that custom roles must be of the format
2018-01-27 00:36:57 +00:00
`[projects|organizations]/{parent-name}/roles/{role-name}` .
2017-11-23 19:26:43 +00:00
* `crypto_key_id` - (Required) The crypto key ID, in the form
`{project_id}/{location_name}/{key_ring_name}/{crypto_key_name}` or
`{location_name}/{key_ring_name}/{crypto_key_name}` .
In the second form, the provider's project setting will be used as a fallback.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are
exported:
* `etag` - (Computed) The etag of the crypto key's IAM policy.
2017-12-11 18:24:53 +00:00
## Import
IAM binding imports use space-delimited identifiers; first the resource in question and then the role. These bindings can be imported using the `crypto_key_id` and role, e.g.
```
2018-05-22 19:48:20 +00:00
$ terraform import google_kms_crypto_key_iam_binding.crypto_key "my-gcp-project/us-central1/my-key-ring/my-crypto-key roles/editor"
2017-12-11 18:24:53 +00:00
```