-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaws-ubuntu.pkr.hcl
86 lines (72 loc) · 1.57 KB
/
aws-ubuntu.pkr.hcl
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
variable "profile" {
type = string
default = "dev_cli"
}
variable "source_ami" {
type = string
default = "ami-06db4d78cb1d3bbf9"
}
variable "instance_type" {
type = string
default = "t2.micro"
}
variable "vpc_id" {
type = string
default = "vpc-055b7ed82be744193"
}
variable "subnet_id" {
type = string
default = "subnet-0edc53e23cb32476a"
}
variable "region" {
type = string
default = "us-east-1"
}
variable "ssh_username" {
type = string
default = "admin"
}
variable "ami_users" {
type = list(string)
default = ["026310524371", "009251910612"]
}
packer {
required_plugins {
amazon = {
version = ">= 1.0.0"
source = "github.com/hashicorp/amazon"
}
}
}
source "amazon-ebs" "debian" {
ami_name = "Ami_${formatdate("YYYY_MM_DD_hh_mm_ss", timestamp())}"
profile = var.profile
source_ami = var.source_ami
instance_type = var.instance_type
vpc_id = var.vpc_id
subnet_id = var.subnet_id
region = var.region
ssh_username = var.ssh_username
ami_users = var.ami_users
}
build {
sources = ["source.amazon-ebs.debian"]
provisioner "file" {
source = "webapp.zip" # Local path to the file you want to copy
destination = "/tmp/webapp.zip"
}
provisioner "file" {
source = "nodeserver.service"
destination = "/tmp/nodeserver.service"
}
provisioner "shell" {
scripts = [
"./setup.sh",
"./autostart.sh",
"./cloudwatch.sh"]
}
post-processor "manifest" {
output = "manifest.json"
strip_path = true
}
}