From b3895c6af1f1d57d5fb2fd895f9950b55246a157 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Mon, 13 Feb 2023 17:48:19 -0800 Subject: packer: add packer ubuntu template --- packer/application.pkr.hcl | 72 ++++++++++++++++++++++++++++++++++++++++++++++ packer/ubuntu.pkr.hcl | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 packer/application.pkr.hcl create mode 100644 packer/ubuntu.pkr.hcl (limited to 'packer') diff --git a/packer/application.pkr.hcl b/packer/application.pkr.hcl new file mode 100644 index 0000000..4bc7aa8 --- /dev/null +++ b/packer/application.pkr.hcl @@ -0,0 +1,72 @@ +packer { + required_plugins { + amazon = { + version = ">= 1.0.1" + source = "github.com/hashicorp/amazon" + } + } +} + +data "hcp-packer-iteration" "ubuntu" { + bucket_name = "learn-packer-ubuntu" + channel = "production" +} + +data "hcp-packer-image" "ubuntu-east" { + bucket_name = "learn-packer-ubuntu" + iteration_id = data.hcp-packer-iteration.ubuntu.id + cloud_provider = "aws" + region = "us-east-2" +} + +data "hcp-packer-image" "ubuntu-west" { + bucket_name = "learn-packer-ubuntu" + iteration_id = data.hcp-packer-iteration.ubuntu.id + cloud_provider = "aws" + region = "us-west-1" +} + +source "amazon-ebs" "application-east" { + ami_name = "packer_AWS_{{timestamp}}" + + region = "us-east-2" + source_ami = data.hcp-packer-image.ubuntu-east.id + instance_type = "t2.small" + ssh_username = "ubuntu" + ssh_agent_auth = false + + tags = { + Name = "learn-packer-application" + } +} + +source "amazon-ebs" "application-west" { + ami_name = "packer_AWS_{{timestamp}}" + + region = "us-west-1" + source_ami = data.hcp-packer-image.ubuntu-west.id + instance_type = "t2.small" + ssh_username = "ubuntu" + ssh_agent_auth = false + + tags = { + Name = "learn-packer-application" + } +} + +build { + hcp_packer_registry { + bucket_name = "learn-packer-application" + description = <