mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-28 17:02:05 +03:00
demo-16
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
resource "aws_security_group" "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"]
|
||||
}
|
||||
|
||||
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.name}"]
|
||||
}
|
||||
|
||||
tags {
|
||||
Name = "myinstance"
|
||||
}
|
||||
}
|
||||
resource "aws_security_group" "elb-securitygroup" {
|
||||
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"]
|
||||
}
|
||||
|
||||
ingress {
|
||||
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