-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb.pkr.hcl
40 lines (34 loc) · 996 Bytes
/
web.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
variable "region" {
type = string
default = "eu-central-1"
}
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
# source blocks are generated from your builders; a source can be referenced in
# build blocks. A build block runs provisioners and post-processors on a
# source.
source "amazon-ebs" "terraform-web-pbl-19" {
ami_name = "terraform-web-pbl-19-${local.timestamp}"
instance_type = "t2.micro"
region = var.region
source_ami_filter {
filters = {
name = "RHEL_HA-8.6.0_HVM-20220503-x86_64-2-Hourly2-GP2"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["309956199498"]
}
ssh_username = "ec2-user"
tag {
key = "Name"
value = "terraform-web-pbl-19"
}
}
# a build block invokes sources and runs provisioning steps on them.
build {
sources = ["source.amazon-ebs.terraform-web-pbl-19"]
provisioner "shell" {
script = "web.sh"
}
}