@@ -55,54 +55,55 @@ packer {
5555 }
5656}
5757
58- source "qemu" "supabase_postgres" {
59- vm_name = " ubuntu-2004-amd64-iso.qcow2"
60- iso_url = " https://www.releases.ubuntu.com/20.04/ubuntu-20.04.6-live-server-amd64.iso"
61- iso_checksum = " sha256:b8f31413336b9393ad5d8ef0282717b2ab19f007df2e9ed5196c13d8f9153c8b"
62- # vm_name = "ubuntu-2404-amd64.raw"
63- # iso_url = "https://www.releases.ubuntu.com/24.04/ubuntu-24.04-live-server-amd64.iso"
64- memory = 20000
65- disk_image = false
66- output_directory = " output_images"
67- shutdown_command = " echo 'packer' | sudo -S shutdown -P now"
68- disk_size = " 9000M"
69- format = " qcow2"
70- accelerator = " kvm"
71- net_device = " virtio-net"
72- disk_interface = " virtio"
73- boot_wait = " 10s"
74-
75- boot_command = [
76- # Make the language selector appear...
77- " <up><wait>" ,
78- # ...then get rid of it
79- " <up><wait><esc><wait>" ,
80-
81- # Go to the other installation options menu and leave it
82- " <f6><wait><esc><wait>" ,
83-
84- # Remove the kernel command-line that already exists
85- " <bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>" ,
86- " <bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>" ,
87- " <bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>" ,
88-
89- # Add kernel command-line and start install
90- " /casper/vmlinuz " ,
91- " initrd=/casper/initrd " ,
92- " autoinstall " ,
93- " ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/ " ,
94- " <enter>"
95- ]
96- http_directory = " http"
97- ssh_username = " packer"
98- ssh_password = " packer"
99- ssh_timeout = " 60m"
58+ source "amazon-ebs" "ubuntu" {
59+ ami_name = " ${ var . ami_name } -${ var . postgres-version } "
60+ instance_type = " c6g.4xlarge"
61+ region = " ${ var . region } "
62+ source_ami_filter {
63+ filters = {
64+ name = " ${ var . ami_name } -${ var . postgres-version } -stage-1"
65+ root-device-type = " ebs"
66+ virtualization-type = " hvm"
67+ }
68+ most_recent = true
69+ owners = [" amazon" , " self" ]
70+ }
71+
72+ communicator = " ssh"
73+ ssh_pty = true
74+ ssh_username = " ubuntu"
75+ ssh_timeout = " 5m"
76+
77+ associate_public_ip_address = true
78+
79+
80+ ena_support = true
81+
82+ run_tags = {
83+ creator = " packer"
84+ appType = " postgres"
85+ packerExecutionId = " ${ var . packer-execution-id } "
86+ }
87+ run_volume_tags = {
88+ creator = " packer"
89+ appType = " postgres"
90+ }
91+ snapshot_tags = {
92+ creator = " packer"
93+ appType = " postgres"
94+ }
95+ tags = {
96+ creator = " packer"
97+ appType = " postgres"
98+ postgresVersion = " ${ var . postgres-version } "
99+ sourceSha = " ${ var . git-head-version } "
100+ }
100101}
101102
102103build {
103104 name = " nix-packer-ubuntu"
104105 sources = [
105- " source.qemu.supabase_postgres "
106+ " source.amazon-ebs.ubuntu "
106107 ]
107108
108109 # Copy ansible playbook
0 commit comments