66 "github.com/terraform-linters/tflint-ruleset-aws/project"
77)
88
9- // TODO: Write the rule's description here
10- // AwsSecurityGroupRuleDeprecatedRule checks ...
9+ // AwsSecurityGroupRuleDeprecatedRule checks that aws_security_group_rule is not used
1110type AwsSecurityGroupRuleDeprecatedRule struct {
1211 tflint.DefaultRule
1312
@@ -18,9 +17,8 @@ type AwsSecurityGroupRuleDeprecatedRule struct {
1817// NewAwsSecurityGroupRuleDeprecatedRule returns new rule with default attributes
1918func NewAwsSecurityGroupRuleDeprecatedRule () * AwsSecurityGroupRuleDeprecatedRule {
2019 return & AwsSecurityGroupRuleDeprecatedRule {
21- // TODO: Write resource type and attribute name here
22- resourceType : "..." ,
23- attributeName : "..." ,
20+ resourceType : "aws_security_group_rule" ,
21+ attributeName : "security_group_id" ,
2422 }
2523}
2624
@@ -31,28 +29,21 @@ func (r *AwsSecurityGroupRuleDeprecatedRule) Name() string {
3129
3230// Enabled returns whether the rule is enabled by default
3331func (r * AwsSecurityGroupRuleDeprecatedRule ) Enabled () bool {
34- // TODO: Determine whether the rule is enabled by default
35- return true
32+ return false
3633}
3734
3835// Severity returns the rule severity
3936func (r * AwsSecurityGroupRuleDeprecatedRule ) Severity () tflint.Severity {
40- // TODO: Determine the rule's severiry
41- return tflint .ERROR
37+ return tflint .WARNING
4238}
4339
4440// Link returns the rule reference link
4541func (r * AwsSecurityGroupRuleDeprecatedRule ) Link () string {
46- // TODO: If the rule is so trivial that no documentation is needed, return "" instead.
4742 return project .ReferenceLink (r .Name ())
4843}
4944
50- // TODO: Write the details of the inspection
51- // Check checks ...
45+ // Check that aws_security_group_rule resource is not used
5246func (r * AwsSecurityGroupRuleDeprecatedRule ) Check (runner tflint.Runner ) error {
53- // TODO: Write the implementation here. See this documentation for what tflint.Runner can do.
54- // https://pkg.go.dev/github.com/terraform-linters/tflint-plugin-sdk/tflint#Runner
55-
5647 resources , err := runner .GetResourceContent (r .resourceType , & hclext.BodySchema {
5748 Attributes : []hclext.AttributeSchema {
5849 {Name : r .attributeName },
0 commit comments