-
Notifications
You must be signed in to change notification settings - Fork 0
/
compute.tf
48 lines (40 loc) · 976 Bytes
/
compute.tf
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
/*
# Create varnish AMI
resource "aws_ami" "varnish_ami" {
name = "ampdev_varnish_ami"
virtualization_type = "hvm"
root_device_name = "/dev/xvda"
ebs_block_device {
device_name = "/dev/xvda"
volume_size = 10
volume_type = "gp2"
encrypted = true
delete_on_termination = true
}
user_data = file("install_varnish.sh")
}
*/
# create varnish instance
data "aws_ami" "varnish_instance" {
executable_users = ["self"]
most_recent = true
owners = ["self"]
filter {
name = "name"
values = ["amzn2-ami-kernel-5.10-hvm-2.0.20220426.0-x86_64-gp2.*"]
}
filter {
name = "root-device-type"
values = ["ebs"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
resource "aws_instance" "varnish_instance" {
ami = data.aws_ami.varnish_instance.id
instance_type = var.ec2_instance_type["varnish"]
key_name = var.key_name
user_data = file("install_varnish.sh")
}