terraform-aws-modules / terraform-aws-security-group

Terraform module to create AWS Security Group resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/security-group/aws
Other
562 stars 1.08k forks source link

feat: Move to using for_each for resource blocks #326

Closed pincher95 closed 1 month ago

pincher95 commented 3 months ago

Description

Move the security groups rules resource blocks to using the for_each meta-argument from the count.

Motivation and Context

It is pretty widely understood that using the count meta-argument can cause churn (ref) in some contexts, such as the context in which this module is used.

Breaking Changes

This change will break all security group rules resources based on count. It will cause churn when switching from an old count-based version of the module to a for_each-based version, because the resources are switching from being an ordered list (sg_rule[0], sg_rule[1], etc.) to a map (sg_rule["443-443-tcp"], sg_rule["22-22-tcp"], etc.).

How Has This Been Tested?

pincher95 commented 3 months ago

@antonbabenko @bryantbiggs Can you please check this PR.

Thank you

bryantbiggs commented 2 months ago

I think if we are going to do a breaking change on this module, we should evaluate all potential changes in order to minimize the amount of disruption. For example, I would hope in the next breaking change we would drop the use of aws_security_group_rule and replace it with aws_vpc_security_group_ingress_rule/ aws_vpc_security_group_egress_rule

github-actions[bot] commented 1 month ago

This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days

github-actions[bot] commented 1 month ago

This PR was automatically closed because of stale in 10 days

github-actions[bot] commented 2 weeks ago

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.