From ca4cb3b3b9ae9ef48396f4a57a756fc96d01bd76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taneli=20Lepp=C3=A4?= Date: Tue, 3 Jan 2023 16:23:23 +0100 Subject: [PATCH] Fixed delete_rule in compute-mig module for stateful disks. --- modules/compute-mig/README.md | 2 +- modules/compute-mig/main.tf | 4 ++-- tests/modules/compute_mig/test_plan.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/compute-mig/README.md b/modules/compute-mig/README.md index ba922670df..8bdb233868 100644 --- a/modules/compute-mig/README.md +++ b/modules/compute-mig/README.md @@ -321,7 +321,7 @@ module "nginx-mig" { } } stateful_disks = { - repd-1 = null + repd-1 = false } } # tftest modules=2 resources=3 diff --git a/modules/compute-mig/main.tf b/modules/compute-mig/main.tf index 35f255a682..65ce55b8e9 100644 --- a/modules/compute-mig/main.tf +++ b/modules/compute-mig/main.tf @@ -71,7 +71,7 @@ resource "google_compute_instance_group_manager" "default" { for_each = var.stateful_disks content { device_name = stateful_disk.key - delete_rule = stateful_disk.value + delete_rule = stateful_disk.value ? "ON_PERMANENT_INSTANCE_DELETION" : "NEVER" } } @@ -161,7 +161,7 @@ resource "google_compute_region_instance_group_manager" "default" { for_each = var.stateful_disks content { device_name = stateful_disk.key - delete_rule = stateful_disk.value + delete_rule = stateful_disk.value ? "ON_PERMANENT_INSTANCE_DELETION" : "NEVER" } } diff --git a/tests/modules/compute_mig/test_plan.py b/tests/modules/compute_mig/test_plan.py index e24a7ca70c..7fec3c1bd2 100644 --- a/tests/modules/compute_mig/test_plan.py +++ b/tests/modules/compute_mig/test_plan.py @@ -84,7 +84,7 @@ def test_stateful_mig(plan_runner): "Test stateful instances - mig." stateful_disks = '''{ - persistent-disk-1 = null + persistent-disk-1 = false }''' _, resources = plan_runner(stateful_disks=stateful_disks) assert len(resources) == 1