packer/packer-ami.pkr.hcl

43 lines
842 B
HCL
Raw Permalink Normal View History

2024-11-12 18:10:46 +00:00
packer {
required_plugins {
amazon = {
version = ">= 1.2.8"
source = "github.com/hashicorp/amazon"
}
}
}
source "amazon-ebs" "ubuntu" {
2024-11-12 18:15:34 +00:00
ami_name = "packer-ami"
2024-11-12 18:10:46 +00:00
instance_type = "t2.nano"
source_ami_filter {
filters = {
name = "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["099720109477"]
}
ssh_username = "ubuntu"
}
build {
name = "runner-manager-ami-packer"
sources = [
"source.amazon-ebs.ubuntu"
]
provisioner "file" {
source = "privateKey.pem"
destination = "~/.ssh/key.pem"
}
provisioner "shell" {
inline = [
"chmod 400 ~/.ssh/key.pem"
]
}
provisioner "shell" {
script = "install-docker.sh"
}
}