Skip to content

Commit

Permalink
Reworded encryption variable to be more descriptive
Browse files Browse the repository at this point in the history
encryption => encryption_key_names
  • Loading branch information
06kellyjac committed Feb 5, 2020
1 parent b6d309c commit 9914446
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Functional examples are included in the
| bucket\_policy\_only | Disable ad-hoc ACLs on specified buckets. Defaults to true. Map of lowercase unprefixed name => boolean | map | `<map>` | no |
| bucket\_viewers | Map of lowercase unprefixed name => comma-delimited IAM-style bucket viewers. | map | `<map>` | no |
| creators | IAM-style members who will be granted roles/storage.objectCreators on all buckets. | list | `<list>` | no |
| encryption | Optional map of lowercase unprefixed name => string, empty strings are ignored. | map | `<map>` | no |
| encryption\_key\_names | Optional map of lowercase unprefixed name => string, empty strings are ignored. | map | `<map>` | no |
| force\_destroy | Optional map of lowercase unprefixed name => boolean, defaults to false. | map | `<map>` | no |
| labels | Labels to be attached to the buckets | map | `<map>` | no |
| lifecycle\_rules | List of lifecycle rules to configure. Format is the same as described in provider documentation https://www.terraform.io/docs/providers/google/r/storage_bucket.html#lifecycle_rule except condition.matches_storage_class should be a comma delimited string. | object | `<list>` | no |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ resource "google_storage_bucket" "buckets" {
# There is no enabled = false attribute available to ask terraform to ignore the block
dynamic "encryption" {
# If an encryption key name is set for this bucket name -> Create a single encryption block
for_each = trimspace(lookup(var.encryption, lower(element(var.names, count.index)), "")) != "" ? [true] : []
for_each = trimspace(lookup(var.encryption_key_names, lower(element(var.names, count.index)), "")) != "" ? [true] : []
content {
default_kms_key_name = trimspace(
lookup(
var.encryption,
var.encryption_key_names,
lower(element(var.names, count.index)),
"Error retrieving kms key name", # Should be unreachable due to the for_each check
# Omitting default is deprecated & can help show if there was a bug
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ variable "versioning" {
default = {}
}

variable "encryption" {
variable "encryption_key_names" {
description = "Optional map of lowercase unprefixed name => string, empty strings are ignored."
default = {}
}
Expand Down

0 comments on commit 9914446

Please sign in to comment.