Closed
Description
This is pointing me to pages of discussion from over a year ago. Seems this bug is still happening
2 error(s) occurred:
- aws_security_group_rule.ivory.0: [WARN] A duplicate Security Group rule was found on (sg-4f0f7836). This may be
a side effect of a now-fixed Terraform issue causing two security groups with
identical attributes but different source_security_group_ids to overwrite each
other in the state. See Consider security groups with source security groups when hashing #2376 for more
information and instructions for recovery. Error message: the specified rule "peer: 199.58.192.98/32, TCP, from port: 22, to port: 22, ALLOW" already exists - aws_security_group_rule.ivory.1: [WARN] A duplicate Security Group rule was found on (sg-4f0f7836). This may be
a side effect of a now-fixed Terraform issue causing two security groups with
identical attributes but different source_security_group_ids to overwrite each
other in the state. See Consider security groups with source security groups when hashing #2376 for more
information and instructions for recovery. Error message: the specified rule "peer: 35.161.227.236/32, TCP, from port: 22, to port: 22, ALLOW" already exists
I have 2 of these pointing to 2 different security groups. If I have just 1 of these, it works. If I have 2 it fails with the above.
resource "aws_security_group_rule" "admin" {
type = "ingress"
from_port = 22
to_port = 22
protocol = "tcp"
security_group_id = "${aws_security_group.admin.id}" # for the 2nd one, this was changed to another ID
cidr_blocks = ["${var.admin_ips[count.index]}/32"]
count = "${length(var.admin_ips)}"
}