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

add flag prevent destroy to data disk #822

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions backend_modules/libvirt/host/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ resource "libvirt_volume" "data_disk" {
size = (var.additional_disk_size == null? 0: var.additional_disk_size) * 1024 * 1024 * 1024
pool = lookup(var.volume_provider_settings, "pool", "default")
count = var.additional_disk_size == null? 0 : var.additional_disk_size > 0 ? var.quantity : 0
lifecycle { prevent_destroy = var.prevent_additional_disk_destroy }
}

resource "libvirt_cloudinit_disk" "cloudinit_disk" {
Expand Down
6 changes: 6 additions & 0 deletions backend_modules/null/host/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ variable "additional_disk_size" {
default = null
}

variable "prevent_additional_disk_destroy" {
description = "should the additional disk be protected against destruction"
type = bool
default = false
}

variable "volume_provider_settings" {
description = "Map of volume-provider-specific settings, see the backend-specific README file"
default = {}
Expand Down
7 changes: 4 additions & 3 deletions modules/mirror/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ module "mirror" {

image = "opensuse151"

provider_settings = var.provider_settings
additional_disk_size = var.repository_disk_size
volume_provider_settings = var.volume_provider_settings
provider_settings = var.provider_settings
additional_disk_size = var.repository_disk_size
prevent_additional_disk_destroy = true
volume_provider_settings = var.volume_provider_settings
}

output "configuration" {
Expand Down