У меня сработал приведенный ниже код, который создает правила группы безопасности, используя aws_security_group_rule
, как я хотел.
resource "aws_security_group" "My_VPC_Security_Group" {
vpc_id = aws_vpc.My_VPC.id
name = "My VPC Security Group"
description = "My VPC Security Group"
}
resource "aws_security_group_rule" "ingress_rule" {
type = "ingress"
from_port = 3389
to_port = 3389
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_security_group.My_VPC_Security_Group.id
}
resource "aws_security_group_rule" "egress_rule" {
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_security_group.My_VPC_Security_Group.id
}