Wie definieren Sie mehrere Ingress-Regeln in einer AWS Security Group mit Terraform?
Ich habe es versucht:
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}"
}
aber ich bekomme folgenden fehler:
Error: resource 'aws_security_group_rule.ssh_from_office' config: unknown resource 'resource.sg_allowall' referenced in variable resource.sg_allowall.id