Skip to content

Commit

Permalink
use dynamic variable for disk_encryption_key
Browse files Browse the repository at this point in the history
  • Loading branch information
rune92 committed Dec 6, 2024
1 parent d37be66 commit 38afd3a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/compute-vm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,11 @@ resource "google_compute_instance_template" "default" {
resource_manager_tags = var.tag_bindings
source_image = var.boot_disk.initialize_params.image

disk_encryption_key {
kms_key_self_link = var.encryption != null ? var.encryption.kms_key_self_link : null
dynamic "disk_encryption_key" {
for_each = var.encryption != null ? [""] : []
content {
kms_key_self_link = var.encryption.kms_key_self_link
}
}
}

Expand Down

0 comments on commit 38afd3a

Please sign in to comment.