-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
52 lines (49 loc) · 1.15 KB
/
main.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
49
50
51
52
resource "aws_instance" "managed_node" {
ami = var.instance_ami
count = var.instance_count
instance_type = var.managed_instance_type
key_name = var.keyname
vpc_security_group_ids = [aws_security_group.tf-sec-gr.id]
iam_instance_profile = var.iam_instance_profile
tags = {
Name = "ansible_${element(var.tags, count.index)}"
stack = "ansible_project"
environment = "development"
}
}
resource "aws_security_group" "tf-sec-gr" {
name = var.security_group
tags = {
Name = var.security_group
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 5000
to_port = 5000
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 3000
to_port = 3000
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 5432
to_port = 5432
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = -1
cidr_blocks = ["0.0.0.0/0"]
}
}