Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: add aws_security_group_inline_rules rule #793

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

kayman-mk
Copy link
Contributor

@kayman-mk kayman-mk commented Dec 16, 2024

Adds a new rule to ensure that ingress and egress blocks in aws_security_group are not used.

Avoid using the ingress and egress arguments of the aws_security_group resource to configure in-line rules, as they have difficulties managing multiple CIDR blocks and lack unique IDs, tags, and descriptions. To prevent these issues, follow the current best practice of using the aws_vpc_security_group_egress_rule and aws_vpc_security_group_ingress_rule resources, with one CIDR block per rule.

Closes #419

@kayman-mk kayman-mk marked this pull request as ready for review December 16, 2024 09:56
@kayman-mk
Copy link
Contributor Author

Not sure how to decide about "enabled by default" and "severity".

docs/rules/README.md.tmpl Outdated Show resolved Hide resolved

Refrain from using the `ingress` and `egress` arguments of the `aws_security_group` resource for in-line rules, as they have difficulties managing multiple CIDR blocks and historically lack unique IDs, tags, and descriptions. To prevent these issues, follow the best practice of using the `aws_vpc_security_group_egress_rule` and `aws_vpc_security_group_ingress_rule` resources, with one CIDR block per rule.

Avoid using the `aws_security_group` resource with in-line rules (using the ingress and egress arguments) alongside the `aws_vpc_security_group_egress_rule`, `aws_vpc_security_group_ingress_rule`, or `aws_security_group_rule` resources. This practice can lead to rule conflicts, perpetual differences, and rules being overwritten.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sentences appear to be copied from official references, but they feel a bit odd to include in this section.
Can you tidy up these sentences and rewrite them to explain why this rule is intended to disallow inline rules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be a duplication. Paragraph reworked.

@kayman-mk kayman-mk changed the title feat: add aws_security_group_egress_and_ingress_blocks_deprecated rule feat: add aws_security_group_inline_rules rule Jan 10, 2025
@kayman-mk kayman-mk requested a review from wata727 January 10, 2025 11:24
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants