Copy

PHOTO EMBED

Sun Mar 24 2024 15:51:03 GMT+0000 (Coordinated Universal Time)

Saved by @Vivekstyn

resource "aws_security_group" "sg1" {
  name        = "sg1"
  description = "Allow inbound rule"
  vpc_id      = aws_vpc.myvpc.id

  ingress {
    description = "allow incoming traffic to instance-1"
    from_port   = 80
    to_port     = 80
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
  ingress {
    description = "allow incoming traffic to instance-1"
    from_port   = 22
    to_port     = 22
    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"]
  }
  tags = {
    name = "sg1"
  }
}
content_copyCOPY