Как определить несколько правил входа в группу безопасности AWS с помощью Terraform?
Я пробовал это:
resource "aws_security_group" "sg_allowall" {
  name = "${var.prefix}-allow"
  ingress {
    from_port   = "443"
    to_port     = "443"
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
  egress {
    from_port   = "0"
    to_port     = "0"
    protocol    = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }
}
resource "aws_security_group_rule" "ssh_from_office" {
  type            = "ingress"
  from_port       = 22
  to_port         = 22
  protocol        = "tcp"
  cidr_blocks     = ["192.202.168.66/32"]
  security_group_id = "${resource.sg_allowall.id}"
}
но я получаю следующую ошибку:
Error: resource 'aws_security_group_rule.ssh_from_office' config: unknown resource 'resource.sg_allowall' referenced in variable resource.sg_allowall.id
