29 lines
622 B
Terraform
29 lines
622 B
Terraform
|
# ---------------------------
|
||
|
# Security Group
|
||
|
# ---------------------------
|
||
|
resource "aws_security_group" "hands_on_ec2_sg" {
|
||
|
name = "provisioning-ec2-sg"
|
||
|
description = "For EC2 Linux"
|
||
|
vpc_id = aws_vpc.hands_on_vpc.id
|
||
|
tags = {
|
||
|
# Name = "userXX-hands-on-ec2-sg"
|
||
|
Name = "provisioning-ec2-sg"
|
||
|
}
|
||
|
|
||
|
# インバウンドルール
|
||
|
ingress {
|
||
|
from_port = 22
|
||
|
to_port = 22
|
||
|
protocol = "tcp"
|
||
|
cidr_blocks = ["3.112.23.0/29"]
|
||
|
}
|
||
|
|
||
|
# アウトバウンドルール
|
||
|
egress {
|
||
|
from_port = 0
|
||
|
to_port = 0
|
||
|
protocol = "-1"
|
||
|
cidr_blocks = ["0.0.0.0/0"]
|
||
|
}
|
||
|
}
|