-
Notifications
You must be signed in to change notification settings - Fork 558
/
sonar.tf
49 lines (43 loc) · 1.11 KB
/
sonar.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
resource "aws_instance" "mySonarInstance" {
ami = "ami-0ee23bfc74a881de5"
key_name = var.key_name
instance_type = "t2.micro"
vpc_security_group_ids = [aws_security_group.sonar-sg-2022.id]
tags= {
Name = "sonar_instance"
}
}
resource "aws_security_group" "sonar-sg-2022" {
name = "security_sonar_group_2022"
description = "security group for Sonar"
ingress {
from_port = 9000
to_port = 9000
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
# outbound from Sonar server
egress {
from_port = 0
to_port = 65535
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
tags= {
Name = "security_sonar"
}
}
# Create Elastic IP address for Sonar instance
resource "aws_eip" "mySonarInstance" {
vpc = true
instance = aws_instance.mySonarInstance.id
tags= {
Name = "sonar_elastic_ip"
}
}