Skip to content

Commit

Permalink
add new packer builds
Browse files Browse the repository at this point in the history
  • Loading branch information
joek-duplo committed Feb 7, 2024
1 parent 2f71785 commit 216a01c
Showing 1 changed file with 292 additions and 0 deletions.
292 changes: 292 additions & 0 deletions packer/aws.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Settings for AWS
variable "aws_instance_type" { default = "t3.small" }
variable "aws_instance_type_arm64" { default = "t4g.small" }
variable "aws_region" { default = "us-west-2" }
variable "aws_vpc_id" { default = "vpc-083b7145ef48f1f6d" }
variable "aws_subnet_id" { default = "subnet-01ebe232b391d652b" }
Expand Down Expand Up @@ -204,6 +205,122 @@ source "amazon-ebs" "ubuntu-22" {
}
}

source "amazon-ebs" "ubuntu-20-arm64" {
ami_name = "${local.image_family}-ubuntu20-arm64-${local.image_version}"
ami_description = "${local.image_description} arm64 (ubuntu20)"
instance_type = var.aws_instance_type_arm64
region = var.aws_region
vpc_id = var.aws_vpc_id
subnet_id = var.aws_subnet_id
security_group_id = var.aws_security_group_id
iam_instance_profile = var.aws_iam_instance_profile
associate_public_ip_address = true

temporary_key_pair_type = var.temporary_key_pair_type
ssh_username = "ubuntu"
ssh_interface = "session_manager"

source_ami_filter {
filters = {
name = "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-arm64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = local.ubuntu_owners
}

# Build a public AMI
encrypt_boot = false
ami_groups = local.is_public ? ["all"] : []
ami_regions = [for region in local.ami_regions: region if region != var.aws_region]

# Customize the volumes
launch_block_device_mappings {
device_name = "/dev/sda1"
encrypted = false
volume_size = 35
volume_type = "gp3"
delete_on_termination = true
}

# Source instance tags.
run_tags = {
Name = "Packer Builder: ${local.image_family}-ubuntu20-arm64-${local.image_version}"
Creator = "Packer"
}
run_volume_tags = {
Creator = "Packer"
}

# Target AMI tags.
tags = {
Name = "${local.image_family}-ubuntu20-arm64-${local.image_version}"
Creator = "Packer"
}
snapshot_tags = {
Creator = "Packer"
}
}

source "amazon-ebs" "ubuntu-22-arm64" {
ami_name = "${local.image_family}-ubuntu22-arm64_${local.image_version}"
ami_description = "${local.image_description} arm64 (ubuntu22)"
instance_type = var.aws_instance_type_arm64
region = var.aws_region
vpc_id = var.aws_vpc_id
subnet_id = var.aws_subnet_id
security_group_id = var.aws_security_group_id
iam_instance_profile = var.aws_iam_instance_profile
associate_public_ip_address = true

temporary_key_pair_type = var.temporary_key_pair_type
ssh_username = "ubuntu"
ssh_interface = "session_manager"

source_ami_filter {
filters = {
name = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-arm64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = local.ubuntu_owners
}

# Build a public AMI
encrypt_boot = false
ami_groups = local.is_public ? ["all"] : []
ami_regions = [for region in local.ami_regions: region if region != var.aws_region]

# Customize the volumes
launch_block_device_mappings {
device_name = "/dev/sda1"
encrypted = false
volume_size = 35
volume_type = "gp3"
delete_on_termination = true
}

# Source instance tags.
run_tags = {
Name = "Packer Builder: ${local.image_family}-ubuntu22-arm64-${local.image_version}"
Creator = "Packer"
}
run_volume_tags = {
Creator = "Packer"
}

# Target AMI tags.
tags = {
Name = "${local.image_family}-ubuntu22-arm64-${local.image_version}"
Creator = "Packer"
}
snapshot_tags = {
Creator = "Packer"
}
}

source "amazon-ebs" "amazonlinux-2" {
ami_name = "${local.image_family}-amazonlinux2-${local.image_version}"
ami_description = "${local.image_description} (amazonlinux2)"
Expand Down Expand Up @@ -261,3 +378,178 @@ source "amazon-ebs" "amazonlinux-2" {
Creator = "Packer"
}
}

source "amazon-ebs" "amazonlinux-2-arm64" {
ami_name = "${local.image_family}-amazonlinux2-arm64-${local.image_version}"
ami_description = "${local.image_description} arm64 (amazonlinux2)"
instance_type = var.aws_instance_type_arm64
region = var.aws_region
vpc_id = var.aws_vpc_id
subnet_id = var.aws_subnet_id
security_group_id = var.aws_security_group_id
iam_instance_profile = var.aws_iam_instance_profile
associate_public_ip_address = true

temporary_key_pair_type = var.temporary_key_pair_type
ssh_username = "ec2-user"
ssh_interface = "session_manager"

source_ami_filter {
filters = {
name = "amzn2-ami-kernel-5.10-hvm-*-arm64-gp2"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
}

# Build a public AMI
encrypt_boot = false
ami_groups = local.is_public ? ["all"] : []
ami_regions = [for region in local.ami_regions: region if region != var.aws_region]

# Customize the volumes
launch_block_device_mappings {
device_name = "/dev/xvda"
encrypted = false
volume_size = 35
volume_type = "gp3"
delete_on_termination = true
}

# Source instance tags.
run_tags = {
Name = "Packer Builder: ${local.image_family}-amazonlinux2-arm64-${local.image_version}"
Creator = "Packer"
}
run_volume_tags = {
Creator = "Packer"
}

# Target AMI tags.
tags = {
Name = "${local.image_family}-amazonlinux2-arm64-${local.image_version}"
Creator = "Packer"
}
snapshot_tags = {
Creator = "Packer"
}
}


source "amazon-ebs" "amazonlinux-2" {
ami_name = "${local.image_family}-al2023-${local.image_version}"
ami_description = "${local.image_description} (al2023)"
instance_type = var.aws_instance_type
region = var.aws_region
vpc_id = var.aws_vpc_id
subnet_id = var.aws_subnet_id
security_group_id = var.aws_security_group_id
iam_instance_profile = var.aws_iam_instance_profile
associate_public_ip_address = true

temporary_key_pair_type = var.temporary_key_pair_type
ssh_username = "ec2-user"
ssh_interface = "session_manager"

source_ami_filter {
filters = {
name = "al2023-ami-*-kernel-6.1-x86_64"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
}

# Build a public AMI
encrypt_boot = false
ami_groups = local.is_public ? ["all"] : []
ami_regions = [for region in local.ami_regions: region if region != var.aws_region]

# Customize the volumes
launch_block_device_mappings {
device_name = "/dev/xvda"
encrypted = false
volume_size = 35
volume_type = "gp3"
delete_on_termination = true
}

# Source instance tags.
run_tags = {
Name = "Packer Builder: ${local.image_family}-al2023-${local.image_version}"
Creator = "Packer"
}
run_volume_tags = {
Creator = "Packer"
}

# Target AMI tags.
tags = {
Name = "${local.image_family}-al2023-${local.image_version}"
Creator = "Packer"
}
snapshot_tags = {
Creator = "Packer"
}
}

source "amazon-ebs" "amazonlinux-2-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
region = var.aws_region
vpc_id = var.aws_vpc_id
subnet_id = var.aws_subnet_id
security_group_id = var.aws_security_group_id
iam_instance_profile = var.aws_iam_instance_profile
associate_public_ip_address = true

temporary_key_pair_type = var.temporary_key_pair_type
ssh_username = "ec2-user"
ssh_interface = "session_manager"

source_ami_filter {
filters = {
name = "al2023-ami-*-kernel-6.1-arm64"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
}

# Build a public AMI
encrypt_boot = false
ami_groups = local.is_public ? ["all"] : []
ami_regions = [for region in local.ami_regions: region if region != var.aws_region]

# Customize the volumes
launch_block_device_mappings {
device_name = "/dev/xvda"
encrypted = false
volume_size = 35
volume_type = "gp3"
delete_on_termination = true
}

# Source instance tags.
run_tags = {
Name = "Packer Builder: ${local.image_family}-al2023-arm64-${local.image_version}"
Creator = "Packer"
}
run_volume_tags = {
Creator = "Packer"
}

# Target AMI tags.
tags = {
Name = "${local.image_family}-al2023-arm64-${local.image_version}"
Creator = "Packer"
}
snapshot_tags = {
Creator = "Packer"
}
}

0 comments on commit 216a01c

Please sign in to comment.