mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-29 01:02:16 +03:00
+32
-30
@@ -1,50 +1,52 @@
|
||||
resource "aws_security_group" "myinstance" {
|
||||
vpc_id = "${aws_vpc.main.id}"
|
||||
name = "myinstance"
|
||||
vpc_id = aws_vpc.main.id
|
||||
name = "myinstance"
|
||||
description = "security group for my instance"
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
ingress {
|
||||
from_port = 22
|
||||
to_port = 22
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
ingress {
|
||||
from_port = 80
|
||||
to_port = 80
|
||||
protocol = "tcp"
|
||||
security_groups = ["${aws_security_group.elb-securitygroup.id}"]
|
||||
from_port = 22
|
||||
to_port = 22
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
tags {
|
||||
ingress {
|
||||
from_port = 80
|
||||
to_port = 80
|
||||
protocol = "tcp"
|
||||
security_groups = [aws_security_group.elb-securitygroup.id]
|
||||
}
|
||||
|
||||
tags = {
|
||||
Name = "myinstance"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_security_group" "elb-securitygroup" {
|
||||
vpc_id = "${aws_vpc.main.id}"
|
||||
name = "elb"
|
||||
vpc_id = aws_vpc.main.id
|
||||
name = "elb"
|
||||
description = "security group for load balancer"
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
ingress {
|
||||
from_port = 80
|
||||
to_port = 80
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
tags {
|
||||
from_port = 80
|
||||
to_port = 80
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
tags = {
|
||||
Name = "elb"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user