-
Notifications
You must be signed in to change notification settings - Fork 0
/
ami.aws-debian.pkr.hcl
85 lines (70 loc) · 1.53 KB
/
ami.aws-debian.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
packer {
required_plugins {
amazon = {
version = ">= 0.0.2"
source = "github.com/hashicorp/amazon"
}
}
}
variable "aws_region" {
type = string
default = "us-east-1"
}
variable "source_ami" {
type = string
default = "ami-06db4d78cb1d3bbf9"
}
variable "ssh_username" {
type = string
default = "admin"
}
variable "subnet_id" {
type = string
default = "subnet-09c0777a3452b24b7"
}
variable "ami_user" {
type = string
default = "051986808830"
}
variable "ami_region" {
type = string
default = "us-east-1"
}
source "amazon-ebs" "debian_webapp_ami" {
ami_name = "cye6225_${formatdate("YYYY_MM_DD_hh_mm_ss", timestamp())}"
ami_description = "csye6225 AMI"
instance_type = "t2.micro"
region = "${var.aws_region}"
ami_regions = [
"us-east-1", "${var.ami_region}"
]
ami_users = ["${var.ami_user}"]
aws_polling {
delay_seconds = 30
max_attempts = 50
}
source_ami = "${var.source_ami}"
ssh_username = "${var.ssh_username}"
subnet_id = "${var.subnet_id}"
launch_block_device_mappings {
delete_on_termination = true
device_name = "/dev/xvda"
volume_size = 8
volume_type = "gp2"
}
}
build {
sources = ["source.amazon-ebs.debian_webapp_ami"]
provisioner "file" {
source = "webapp.zip"
destination = "~/webapp.zip"
}
provisioner "shell" {
script = "webapp_script.sh"
}
provisioner "shell" {
inline = [
"export DEBIAN_FRONTEND=noninteractive"
]
}
}