Skip to content

Conversation

@armanzeroeight
Copy link
Contributor

Description

We should used the already computed local.security_group_name instead of var.name in security group rule name tag.

Motivation and Context

Its safer to use the local so if the user has decided to set a different name on SG than the EC2 stack.

security_group_name   = try(coalesce(var.security_group_name, var.name), "")

We are already using it for the SG name tag:

 tags = merge(
    var.tags,
    { "Name" = local.security_group_name },
    var.security_group_tags
  )

but not on the rules. This will harmonize that too.

Breaking Changes

No breaking changes

@armanzeroeight armanzeroeight changed the title Use computed local var in sg rule name fix: Use computed local var in sg rule name Oct 14, 2025
@bryantbiggs bryantbiggs changed the title fix: Use computed local var in sg rule name fix: Use computed local.security_group_name in the security group Name tag Oct 14, 2025
@bryantbiggs bryantbiggs merged commit 541cc3d into terraform-aws-modules:master Oct 14, 2025
8 of 9 checks passed
antonbabenko pushed a commit that referenced this pull request Oct 14, 2025
## [6.1.2](v6.1.1...v6.1.2) (2025-10-14)

### Bug Fixes

* Use computed `local.security_group_name` in the security group `Name` tag ([#458](#458)) ([541cc3d](541cc3d))
@antonbabenko
Copy link
Member

This PR is included in version 6.1.2 🎉

@armanzeroeight armanzeroeight deleted the feature/fix-sg-rules-tags branch October 14, 2025 13:57
@armanzeroeight
Copy link
Contributor Author

Cool @antonbabenko and @bryantbiggs 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants