I want using another SG's port for SSH, not 22, but i get error. For example:
resource "aws_security_group" "ws_sg" {
name = "WS SG"
vpc_id = "${aws_vpc.ws_net.id}"
tags = {
"Name" = "WS SG"
}
}
resource "aws_security_group_rule" "inbound_ssh" {
from_port = 28
protocol = "TCP"
security_group_id = aws_security_group.ws_sg.id
to_port = 22
type = "ingress"
cidr_blocks = [ "0.0.0.0/0" ]
}
resource "aws_security_group_rule" "egress" {
from_port = 0
protocol = "all"
security_group_id = aws_security_group.ws_sg.id
to_port = 0
type = "egress"
cidr_blocks = [ "0.0.0.0/0" ]
}
How fix it?
P.S. Maybee, this happing because i have free account?
You mixed up your ports. Instead of
from_port = 28
to_port = 22
it should be:
from_port = 22
to_port = 28