114: terraform: Add support for '--stop-after-disko' parameter r=Lassulus a=dantefromhell



Co-authored-by: dantefromhell <90508808+dantefromhell@users.noreply.github.com>
This commit is contained in:
bors[bot] 2023-06-05 10:42:11 +00:00 committed by GitHub
commit 8ab64f7f09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 1 deletions

View File

@ -24,6 +24,7 @@ module "install" {
nixos_system = module.system-build.result.out nixos_system = module.system-build.result.out
ssh_private_key = var.install_ssh_key ssh_private_key = var.install_ssh_key
debug_logging = var.debug_logging debug_logging = var.debug_logging
stop_after_disko = var.stop_after_disko
instance_id = var.instance_id instance_id = var.instance_id
} }
@ -31,6 +32,10 @@ module "nixos-rebuild" {
depends_on = [ depends_on = [
module.install module.install
] ]
# Do not execute this step if var.stop_after_disko == true
count = var.stop_after_disko ? 0 : 1
source = "../nixos-rebuild" source = "../nixos-rebuild"
nixos_system = module.system-build.result.out nixos_system = module.system-build.result.out
ssh_private_key = var.deployment_ssh_key ssh_private_key = var.deployment_ssh_key

View File

@ -68,3 +68,9 @@ variable "debug_logging" {
description = "Enable debug logging" description = "Enable debug logging"
default = false default = false
} }
variable "stop_after_disko" {
type = bool
description = "Exit after disko formating"
default = false
}

View File

@ -1,5 +1,5 @@
locals { locals {
nixos_anywhere_flags = "${var.debug_logging ? "--debug" : ""} ${var.kexec_tarball_url != null ? "--kexec ${var.kexec_tarball_url}" : "" } --store-paths ${var.nixos_partitioner} ${var.nixos_system} ${var.target_user}@${var.target_host}" nixos_anywhere_flags = "${var.stop_after_disko ? "--stop-after-disko" : ""} ${var.debug_logging ? "--debug" : ""} ${var.kexec_tarball_url != null ? "--kexec ${var.kexec_tarball_url}" : "" } --store-paths ${var.nixos_partitioner} ${var.nixos_system} ${var.target_user}@${var.target_host}"
} }
resource "null_resource" "nixos-remote" { resource "null_resource" "nixos-remote" {

View File

@ -50,3 +50,9 @@ variable "debug_logging" {
description = "Enable debug logging" description = "Enable debug logging"
default = false default = false
} }
variable "stop_after_disko" {
type = bool
description = "Exit after disko formating"
default = false
}