-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathimage.pkr.hcl
37 lines (32 loc) · 998 Bytes
/
image.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
variable "region" {
default = "us-east-1"
}
variable "instance_type" {
default = "t2.micro"
}
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
}
source "amazon-ebs" "ec2-docker" {
ami_name = "Packer-AMI-${local.timestamp}"
ami_description = "Amazon Linux 2 Imaged-AMI Created Via Packer"
instance_type = "${var.instance_type}"
region = "${var.region}"
security_group_ids = ["sg-0ef0ddc40580e6a0a"]
source_ami_filter {
filters = {
name = "amzn2-ami-hvm-2.0.*.1-x86_64-ebs"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
}
ssh_username = "ec2-user"
}
build {
sources = ["source.amazon-ebs.ec2-docker"]
provisioner "ansible" {
playbook_file = "Mention-Ansible-File-Location"
}
}