The linter ignores inline security group rules #904
Replies: 4 comments 2 replies
-
Can you explain what you expect and what the actual behavior is? |
Beta Was this translation helpful? Give feedback.
-
@wata727 and (@bendrucker for moving it from an issue to a general discussion), I think most people would expect the aws rule set to raise a warning about using inline rules. As per official AWS documentation linked and cited above, using inline is not recommended. This mistake is why I started googling Terraform linters.
We could in theory remove checking the inline rules as using them is inherently a bad practice. |
Beta Was this translation helpful? Give feedback.
-
Sounds reasonable! I don't know Go, but there are plenty of examples and a template, so I think I can fix that. |
Beta Was this translation helpful? Give feedback.
-
I started implementing, but I realise there has been a confusion. The existing inline rule does raise error for using it, it is only that it isn't enabled by default. After enabling it, it works as expected. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I just tried the linter to see if it could the common trap of the AWS provider of using the inline security group rules instead of the new egress and ingress rule resources.
According the the documentation.
Further if you use the inline rule, it blocks other people from using the recommended resource.
Yet the linter simply ignores this. If my quick search of the code base is correctly interpreted, there seems to be a check against using the deprecated aws_security_group_rule, but it only checks how the inline rule is used.
Is this a conscious decision? Could we change this?
It would be smooth to handle the rules as part of the group, but sadly it isn't possible for reason I don't quite understand.
Beta Was this translation helpful? Give feedback.
All reactions