aboutsummaryrefslogtreecommitdiff
blob: 4bc7aa8fa89185ad9b6d20fd5d6f7f7ff1f015e0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 = <<EOT
Some nice description about the image being published to HCP Packer Registry.
    EOT
    bucket_labels = {
      "foo-version" = "3.4.0",
      "foo"         = "bar",
    }
  }
  sources = [
    "source.amazon-ebs.application-east",
    "source.amazon-ebs.application-west"
  ]
}
Powered by cgit v1.2.3 (git 2.41.0)