Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed delete_rule in compute-mig module for stateful disks #1078

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/compute-mig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ module "nginx-mig" {
}
}
stateful_disks = {
repd-1 = null
repd-1 = false
}
}
# tftest modules=2 resources=3
Expand Down
4 changes: 2 additions & 2 deletions modules/compute-mig/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down Expand Up @@ -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"
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/modules/compute_mig/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down