/
aws_instance_nginx.tf
46 lines (37 loc) · 982 Bytes
/
aws_instance_nginx.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
data "aws_ami" "nginx" {
most_recent = true
filter {
name = "name"
values = ["nginx*"]
}
owners = [var.aws_account_id]
}
resource "aws_instance" "nginx" {
ami = data.aws_ami.nginx.id
instance_type = "t4g.micro"
key_name = aws_key_pair.key.key_name
subnet_id = var.subnet_id
vpc_security_group_ids = [aws_security_group.nginx.id]
disable_api_termination = true
iam_instance_profile = aws_iam_instance_profile.singlelog_profile.name
root_block_device {
delete_on_termination = true
encrypted = true
volume_size = "10"
}
user_data = <<EOF
#!/bin/bash
sudo service vector restart
EOF
tags = {
Name = "nginx"
}
metadata_options {
http_tokens = "required"
http_endpoint = "enabled"
}
}
resource "aws_iam_instance_profile" "singlelog_profile" {
name = "singlelog_profile"
role = aws_iam_role.singlestore_s3_role.name
}