From 1842586241927fcecf36e2270a8885e72b9fdf3b Mon Sep 17 00:00:00 2001 From: Ludovico Magnocavallo Date: Thu, 29 Sep 2022 09:01:15 +0200 Subject: [PATCH] Bjbloemker-google/master (#843) * Add ability to add KMS encryption to google_compute_instance_template * fix code block Co-authored-by: BJ Bloemker Co-authored-by: bjbloemker-google <109173391+bjbloemker-google@users.noreply.github.com> Co-authored-by: Julio Castillo --- modules/compute-vm/main.tf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/compute-vm/main.tf b/modules/compute-vm/main.tf index 8cbd42151c..3a5881600f 100644 --- a/modules/compute-vm/main.tf +++ b/modules/compute-vm/main.tf @@ -311,6 +311,12 @@ resource "google_compute_instance_template" "default" { config.value.source_type != "attach" ? config.value.name : null ) type = "PERSISTENT" + dynamic "disk_encryption_key" { + for_each = var.encryption != null ? [""] : [] + content { + kms_key_self_link = var.encryption.kms_key_self_link + } + } } }