Skip to content

Commit ca19209

Browse files
authored
feat: Add support for var.labels (#29)
1 parent 3f01a09 commit ca19209

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Functional examples are included in the
5050
| key\_rotation\_period | | string | `"100000s"` | no |
5151
| keyring | Keyring name. | string | n/a | yes |
5252
| keys | Key names. | list(string) | `<list>` | no |
53+
| labels | Labels, provided as a map | map(string) | `<map>` | no |
5354
| location | Location for the keyring. | string | n/a | yes |
5455
| owners | List of comma-separated owners for each key declared in set_owners_for. | list(string) | `<list>` | no |
5556
| prevent\_destroy | Set the prevent_destroy lifecycle attribute on keys. | string | `"true"` | no |

main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ resource "google_kms_crypto_key" "key" {
3838
algorithm = var.key_algorithm
3939
protection_level = var.key_protection_level
4040
}
41+
42+
labels = var.labels
4143
}
4244

4345
resource "google_kms_crypto_key" "key_ephemeral" {
@@ -54,6 +56,8 @@ resource "google_kms_crypto_key" "key_ephemeral" {
5456
algorithm = var.key_algorithm
5557
protection_level = var.key_protection_level
5658
}
59+
60+
labels = var.labels
5761
}
5862

5963
resource "google_kms_crypto_key_iam_binding" "owners" {

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,9 @@ variable "key_protection_level" {
9393
description = "The protection level to use when creating a version based on this template. Default value: \"SOFTWARE\" Possible values: [\"SOFTWARE\", \"HSM\"]"
9494
default = "SOFTWARE"
9595
}
96+
97+
variable "labels" {
98+
type = map(string)
99+
description = "Labels, provided as a map"
100+
default = {}
101+
}

0 commit comments

Comments
 (0)