The ecs_service sub-module in version 6.x has split security group rules into two distinct maps: security_group_ingress_rules and security_group_egress_rules. Additionally, the underlying AWS resources have changed from aws_security_group_rule to aws_vpc_security_group_ingress_rule and aws_vpc_security_group_egress_rule.
Key Mapping Changes:
security_group_rules $\rightarrow$ security_group_ingress_rules AND security_group_egress_rulessource_security_group_id $\rightarrow$ referenced_security_group_idprotocol $\rightarrow$ ip_protocolcidr_blocks $\rightarrow$ cidr_ipv4
Important State Migration:
Because these are different resource types, you cannot use terraform mv. You must remove the old rules from the state and import the new ones manually.
# For Ingress rules
terraform state rm 'module.ecs_service.aws_security_group_rule.this["alb_ingress_3000"]'
terraform state import 'module.ecs_service.aws_vpc_security_group_ingress_rule.this["alb_3000"]' 'sg-xxx'
# For Egress rules
terraform state rm 'module.ecs_service.aws_security_group_rule.this["egress_all"]'
terraform state import 'module.ecs_service.aws_vpc_security_group_egress_rule.this["all"]' 'sg-xxx'