diff options
Diffstat (limited to 'packer/application.pkr.hcl')
-rw-r--r-- | packer/application.pkr.hcl | 72 |
1 files changed, 72 insertions, 0 deletions
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 @@ | |||
1 | packer { | ||
2 | required_plugins { | ||
3 | amazon = { | ||
4 | version = ">= 1.0.1" | ||
5 | source = "github.com/hashicorp/amazon" | ||
6 | } | ||
7 | } | ||
8 | } | ||
9 | |||
10 | data "hcp-packer-iteration" "ubuntu" { | ||
11 | bucket_name = "learn-packer-ubuntu" | ||
12 | channel = "production" | ||
13 | } | ||
14 | |||
15 | data "hcp-packer-image" "ubuntu-east" { | ||
16 | bucket_name = "learn-packer-ubuntu" | ||
17 | iteration_id = data.hcp-packer-iteration.ubuntu.id | ||
18 | cloud_provider = "aws" | ||
19 | region = "us-east-2" | ||
20 | } | ||
21 | |||
22 | data "hcp-packer-image" "ubuntu-west" { | ||
23 | bucket_name = "learn-packer-ubuntu" | ||
24 | iteration_id = data.hcp-packer-iteration.ubuntu.id | ||
25 | cloud_provider = "aws" | ||
26 | region = "us-west-1" | ||
27 | } | ||
28 | |||
29 | source "amazon-ebs" "application-east" { | ||
30 | ami_name = "packer_AWS_{{timestamp}}" | ||
31 | |||
32 | region = "us-east-2" | ||
33 | source_ami = data.hcp-packer-image.ubuntu-east.id | ||
34 | instance_type = "t2.small" | ||
35 | ssh_username = "ubuntu" | ||
36 | ssh_agent_auth = false | ||
37 | |||
38 | tags = { | ||
39 | Name = "learn-packer-application" | ||
40 | } | ||
41 | } | ||
42 | |||
43 | source "amazon-ebs" "application-west" { | ||
44 | ami_name = "packer_AWS_{{timestamp}}" | ||
45 | |||
46 | region = "us-west-1" | ||
47 | source_ami = data.hcp-packer-image.ubuntu-west.id | ||
48 | instance_type = "t2.small" | ||
49 | ssh_username = "ubuntu" | ||
50 | ssh_agent_auth = false | ||
51 | |||
52 | tags = { | ||
53 | Name = "learn-packer-application" | ||
54 | } | ||
55 | } | ||
56 | |||
57 | build { | ||
58 | hcp_packer_registry { | ||
59 | bucket_name = "learn-packer-application" | ||
60 | description = <<EOT | ||
61 | Some nice description about the image being published to HCP Packer Registry. | ||
62 | EOT | ||
63 | bucket_labels = { | ||
64 | "foo-version" = "3.4.0", | ||
65 | "foo" = "bar", | ||
66 | } | ||
67 | } | ||
68 | sources = [ | ||
69 | "source.amazon-ebs.application-east", | ||
70 | "source.amazon-ebs.application-west" | ||
71 | ] | ||
72 | } | ||