Skip to content

Commit

Permalink
update packer build steps for new AMIs
Browse files Browse the repository at this point in the history
  • Loading branch information
joek-duplo committed Feb 7, 2024
1 parent 216a01c commit 274002b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packer/aws.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ source "amazon-ebs" "amazonlinux-2-arm64" {
}


source "amazon-ebs" "amazonlinux-2" {
source "amazon-ebs" "amazonlinux-2023" {
ami_name = "${local.image_family}-al2023-${local.image_version}"
ami_description = "${local.image_description} (al2023)"
instance_type = var.aws_instance_type
Expand Down Expand Up @@ -496,7 +496,7 @@ source "amazon-ebs" "amazonlinux-2" {
}
}

source "amazon-ebs" "amazonlinux-2-arm64" {
source "amazon-ebs" "amazonlinux-2023-arm64" {
ami_name = "${local.image_family}-al2023-arm64-${local.image_version}"
ami_description = "${local.image_description} arm64 (al2023)"
instance_type = var.aws_instance_type_arm64
Expand Down
21 changes: 17 additions & 4 deletions packer/main.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ build {
"sources.amazon-ebs.ubuntu-18",
"sources.amazon-ebs.ubuntu-20",
"sources.amazon-ebs.ubuntu-22",
"sources.amazon-ebs.ubuntu-20-arm64",
"sources.amazon-ebs.ubuntu-22-arm64",
"sources.amazon-ebs.amazonlinux-2",
"sources.amazon-ebs.amazonlinux-2-arm64",
"sources.amazon-ebs.amazonlinux-2023",
"sources.amazon-ebs.amazonlinux-2023-arm64",
"sources.googlecompute.ubuntu-20",
"sources.googlecompute.ubuntu-22"
]
Expand All @@ -44,6 +49,7 @@ build {
environment_vars = [ "DEBIAN_FRONTEND=noninteractive" ]
only = [
"amazon-ebs.ubuntu-18", "amazon-ebs.ubuntu-20", "amazon-ebs.ubuntu-22",
"amazon-ebs.ubuntu-20-arm64", "amazon-ebs.ubuntu-22-arm64",
"googlecompute.ubuntu-20", "googlecompute.ubuntu-22"
]
}
Expand All @@ -54,7 +60,10 @@ build {
environment_vars = [
"DOWNLOAD_REF=${var.agent_git_ref}"
]
only = [ "amazon-ebs.amazonlinux-2" ]
only = [
"amazon-ebs.amazonlinux-2", "amazon-ebs.amazonlinux-2023",
"amazon-ebs.amazonlinux-2-arm64", "amazon-ebs.amazonlinux-2023-arm64"
]
}

// Install - Ubuntu 18
Expand All @@ -74,7 +83,7 @@ build {
"DOWNLOAD_REF=${var.agent_git_ref}",
"DEBIAN_FRONTEND=noninteractive"
]
only = [ "amazon-ebs.ubuntu-20", "googlecompute.ubuntu-20" ]
only = [ "amazon-ebs.ubuntu-20", "amazon-ebs.ubuntu-20-arm64", "googlecompute.ubuntu-20" ]
}

// Install - Ubuntu 22
Expand All @@ -84,15 +93,18 @@ build {
"DOWNLOAD_REF=${var.agent_git_ref}",
"DEBIAN_FRONTEND=noninteractive"
]
only = [ "amazon-ebs.ubuntu-22", "googlecompute.ubuntu-22" ]
only = [ "amazon-ebs.ubuntu-22", "amazon-ebs.ubuntu-22-arm64", "googlecompute.ubuntu-22" ]
}

// Cleanup - Amazon Linux
provisioner "shell" {
inline = [
"sudo rm -rf /home/ec2-user/.history /home/ec2-user/authorized_keys", // user history and SSH authorized keys
]
only = [ "amazon-ebs.amazonlinux-2" ]
only = [
"amazon-ebs.amazonlinux-2", "amazon-ebs.amazonlinux-2023",
"amazon-ebs.amazonlinux-2-arm64", "amazon-ebs.amazonlinux-2023-arm64"
]
}

// Cleanup - Ubuntu
Expand All @@ -102,6 +114,7 @@ build {
]
only = [
"amazon-ebs.ubuntu-18", "amazon-ebs.ubuntu-20", "amazon-ebs.ubuntu-22",
"amazon-ebs.ubuntu-20-arm64", "amazon-ebs.ubuntu-22-arm64",
"googlecompute.ubuntu-20", "googlecompute.ubuntu-22"
]
}
Expand Down

0 comments on commit 274002b

Please sign in to comment.