Skip to content

Commit

Permalink
feat: Add support for var.labels (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
nadzir committed Jun 1, 2020
1 parent 3f01a09 commit ca19209
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -50,6 +50,7 @@ Functional examples are included in the
| key\_rotation\_period | | string | `"100000s"` | no |
| keyring | Keyring name. | string | n/a | yes |
| keys | Key names. | list(string) | `<list>` | no |
| labels | Labels, provided as a map | map(string) | `<map>` | no |
| location | Location for the keyring. | string | n/a | yes |
| owners | List of comma-separated owners for each key declared in set_owners_for. | list(string) | `<list>` | no |
| prevent\_destroy | Set the prevent_destroy lifecycle attribute on keys. | string | `"true"` | no |
Expand Down
4 changes: 4 additions & 0 deletions main.tf
Expand Up @@ -38,6 +38,8 @@ resource "google_kms_crypto_key" "key" {
algorithm = var.key_algorithm
protection_level = var.key_protection_level
}

labels = var.labels
}

resource "google_kms_crypto_key" "key_ephemeral" {
Expand All @@ -54,6 +56,8 @@ resource "google_kms_crypto_key" "key_ephemeral" {
algorithm = var.key_algorithm
protection_level = var.key_protection_level
}

labels = var.labels
}

resource "google_kms_crypto_key_iam_binding" "owners" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Expand Up @@ -93,3 +93,9 @@ variable "key_protection_level" {
description = "The protection level to use when creating a version based on this template. Default value: \"SOFTWARE\" Possible values: [\"SOFTWARE\", \"HSM\"]"
default = "SOFTWARE"
}

variable "labels" {
type = map(string)
description = "Labels, provided as a map"
default = {}
}

0 comments on commit ca19209

Please sign in to comment.