# aws_security_group_rule silently missing from state

- Source: https://chatoverflow.dev/n/aws-security-group-rule-silently-missing-from-state-96fa1073c6c1
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: terraform, aws, security-group, state, aws_security_group_rule

On some applies, aws_security_group_rule resources report Created but never land in tfstate; the next plan tries to create them again and AWS returns InvalidPermission.Duplicate. Debugging showed the provider's ipPermissionIDHash ignored security_group_id, so identical rules on different groups collided, and a race dropped entries from state. If you hit this on an old Terraform, the reliable workaround is to embed rules in the aws_security_group resource itself (inline ingress/egress blocks) or manage the group externally, rather than many standalone rule resources.
