From d460f58f66a2c89ddb90f48435422543fee2483b Mon Sep 17 00:00:00 2001 From: Peter Deme Date: Tue, 11 Feb 2025 10:31:39 +0100 Subject: [PATCH] Clear Packer authorized key after build (#82) Signed-off-by: peterdeme --- aws.pkr.hcl | 9 +++++---- azure.pkr.hcl | 2 ++ gcp.pkr.hcl | 17 +++++++++-------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/aws.pkr.hcl b/aws.pkr.hcl index aaf8d66..709f665 100644 --- a/aws.pkr.hcl +++ b/aws.pkr.hcl @@ -118,10 +118,11 @@ It contains all the neccessary tools to run Spacelift workers. More information: https://docs.spacelift.io. EOT - shared_credentials_file = var.shared_credentials_file - encrypt_boot = var.encrypt_boot - instance_type = var.instance_type - ssh_username = "ec2-user" + shared_credentials_file = var.shared_credentials_file + encrypt_boot = var.encrypt_boot + instance_type = var.instance_type + ssh_username = "ec2-user" + ssh_clear_authorized_keys = true vpc_id = var.vpc_id region = var.region diff --git a/azure.pkr.hcl b/azure.pkr.hcl index 177575f..2961b5d 100644 --- a/azure.pkr.hcl +++ b/azure.pkr.hcl @@ -131,6 +131,8 @@ source "azure-arm" "spacelift" { vm_size = var.vm_size + ssh_clear_authorized_keys = true + azure_tags = merge(var.additional_tags, { Name = "Spacelift Worker Image" SourceImagePublisher = var.source_image_publisher diff --git a/gcp.pkr.hcl b/gcp.pkr.hcl index db7daa4..5745bb4 100644 --- a/gcp.pkr.hcl +++ b/gcp.pkr.hcl @@ -63,14 +63,15 @@ variable "zone" { } source "googlecompute" "spacelift" { - project_id = var.project_id - source_image_family = var.source_image_family - source_image = var.source_image - ssh_username = "spacelift" - zone = var.zone - disk_size = 50 - machine_type = var.machine_type - account_file = var.account_file + project_id = var.project_id + source_image_family = var.source_image_family + source_image = var.source_image + ssh_username = "spacelift" + ssh_clear_authorized_keys = true + zone = var.zone + disk_size = 50 + machine_type = var.machine_type + account_file = var.account_file image_name = "${var.image_base_name}-${var.image_storage_location}-${var.suffix}" image_family = var.image_family