Skip to content

Commit 20ef42a

Browse files
author
Marina Limeira
committed
Add Security group rule
1 parent b25803a commit 20ef42a

11 files changed

+234
-571
lines changed

main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ func main() {
1212
Name: "template",
1313
Version: "0.1.0",
1414
Rules: []tflint.Rule{
15-
rules.NewAwsInstanceExampleTypeRule(),
16-
rules.NewAwsS3BucketExampleLifecycleRule(),
17-
rules.NewGoogleComputeSSLPolicyRule(),
18-
rules.NewTerraformBackendTypeRule(),
15+
rules.NewAwsSecurityGroupRuleInvalidCidrBlockRule(),
1916
},
2017
},
2118
})

rules/aws_instance_example_type.go

Lines changed: 0 additions & 78 deletions
This file was deleted.
Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
11
package rules
22

3-
import (
4-
"testing"
5-
6-
hcl "github.com/hashicorp/hcl/v2"
7-
"github.com/terraform-linters/tflint-plugin-sdk/helper"
8-
)
9-
10-
func Test_AwsInstanceExampleType(t *testing.T) {
11-
tests := []struct {
12-
Name string
13-
Content string
14-
Expected helper.Issues
15-
}{
16-
{
17-
Name: "issue found",
18-
Content: `
19-
resource "aws_instance" "web" {
20-
instance_type = "t2.micro"
21-
}`,
22-
Expected: helper.Issues{
23-
{
24-
Rule: NewAwsInstanceExampleTypeRule(),
25-
Message: "instance type is t2.micro",
26-
Range: hcl.Range{
27-
Filename: "resource.tf",
28-
Start: hcl.Pos{Line: 3, Column: 21},
29-
End: hcl.Pos{Line: 3, Column: 31},
30-
},
31-
},
32-
},
33-
},
34-
}
35-
36-
rule := NewAwsInstanceExampleTypeRule()
37-
38-
for _, test := range tests {
39-
t.Run(test.Name, func(t *testing.T) {
40-
runner := helper.TestRunner(t, map[string]string{"resource.tf": test.Content})
41-
42-
if err := rule.Check(runner); err != nil {
43-
t.Fatalf("Unexpected error occurred: %s", err)
44-
}
45-
46-
helper.AssertIssues(t, test.Expected, runner.Issues)
47-
})
48-
}
49-
}
3+
//
4+
//import (
5+
// "testing"
6+
//
7+
// hcl "github.com/hashicorp/hcl/v2"
8+
// "github.com/terraform-linters/tflint-plugin-sdk/helper"
9+
//)
10+
//
11+
//func Test_AwsInstanceExampleType(t *testing.T) {
12+
// tests := []struct {
13+
// Name string
14+
// Content string
15+
// Expected helper.Issues
16+
// }{
17+
// {
18+
// Name: "issue found",
19+
// Content: `
20+
//resource "aws_instance" "web" {
21+
// instance_type = "t2.micro"
22+
//}`,
23+
// Expected: helper.Issues{
24+
// {
25+
// Rule: NewAwsInstanceExampleTypeRule(),
26+
// Message: "instance type is t2.micro",
27+
// Range: hcl.Range{
28+
// Filename: "resource.tf",
29+
// Start: hcl.Pos{Line: 3, Column: 21},
30+
// End: hcl.Pos{Line: 3, Column: 31},
31+
// },
32+
// },
33+
// },
34+
// },
35+
// }
36+
//
37+
// rule := NewAwsInstanceExampleTypeRule()
38+
//
39+
// for _, test := range tests {
40+
// t.Run(test.Name, func(t *testing.T) {
41+
// runner := helper.TestRunner(t, map[string]string{"resource.tf": test.Content})
42+
//
43+
// if err := rule.Check(runner); err != nil {
44+
// t.Fatalf("Unexpected error occurred: %s", err)
45+
// }
46+
//
47+
// helper.AssertIssues(t, test.Expected, runner.Issues)
48+
// })
49+
// }
50+
//}

rules/aws_s3_bucket_example_lifecycle_rule.go

Lines changed: 0 additions & 81 deletions
This file was deleted.

rules/aws_s3_bucket_example_lifecycle_rule_test.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)