Skip to content

14 files changed

+894
-0
lines changed

docs/rules/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,18 @@ These rules enforce best practices and naming conventions:
493493
|aws_db_proxy_endpoint_invalid_db_proxy_name||
494494
|aws_db_proxy_endpoint_invalid_target_role||
495495
|aws_db_proxy_invalid_engine_family||
496+
|aws_devicefarm_device_pool_invalid_description||
497+
|aws_devicefarm_device_pool_invalid_name||
498+
|aws_devicefarm_device_pool_invalid_project_arn||
499+
|aws_devicefarm_network_profile_invalid_description||
500+
|aws_devicefarm_network_profile_invalid_name||
501+
|aws_devicefarm_network_profile_invalid_project_arn||
502+
|aws_devicefarm_network_profile_invalid_type||
496503
|aws_devicefarm_project_invalid_name||
504+
|aws_devicefarm_upload_invalid_content_type||
505+
|aws_devicefarm_upload_invalid_name||
506+
|aws_devicefarm_upload_invalid_project_arn||
507+
|aws_devicefarm_upload_invalid_type||
497508
|aws_directory_service_conditional_forwarder_invalid_directory_id||
498509
|aws_directory_service_conditional_forwarder_invalid_remote_domain_name||
499510
|aws_directory_service_directory_invalid_description||
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"log"
7+
8+
hcl "github.com/hashicorp/hcl/v2"
9+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
10+
)
11+
12+
// AwsDevicefarmDevicePoolInvalidDescriptionRule checks the pattern is valid
13+
type AwsDevicefarmDevicePoolInvalidDescriptionRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
}
18+
19+
// NewAwsDevicefarmDevicePoolInvalidDescriptionRule returns new rule with default attributes
20+
func NewAwsDevicefarmDevicePoolInvalidDescriptionRule() *AwsDevicefarmDevicePoolInvalidDescriptionRule {
21+
return &AwsDevicefarmDevicePoolInvalidDescriptionRule{
22+
resourceType: "aws_devicefarm_device_pool",
23+
attributeName: "description",
24+
max: 16384,
25+
}
26+
}
27+
28+
// Name returns the rule name
29+
func (r *AwsDevicefarmDevicePoolInvalidDescriptionRule) Name() string {
30+
return "aws_devicefarm_device_pool_invalid_description"
31+
}
32+
33+
// Enabled returns whether the rule is enabled by default
34+
func (r *AwsDevicefarmDevicePoolInvalidDescriptionRule) Enabled() bool {
35+
return true
36+
}
37+
38+
// Severity returns the rule severity
39+
func (r *AwsDevicefarmDevicePoolInvalidDescriptionRule) Severity() string {
40+
return tflint.ERROR
41+
}
42+
43+
// Link returns the rule reference link
44+
func (r *AwsDevicefarmDevicePoolInvalidDescriptionRule) Link() string {
45+
return ""
46+
}
47+
48+
// Check checks the pattern is valid
49+
func (r *AwsDevicefarmDevicePoolInvalidDescriptionRule) Check(runner tflint.Runner) error {
50+
log.Printf("[TRACE] Check `%s` rule", r.Name())
51+
52+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
53+
var val string
54+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
55+
56+
return runner.EnsureNoError(err, func() error {
57+
if len(val) > r.max {
58+
runner.EmitIssueOnExpr(
59+
r,
60+
"description must be 16384 characters or less",
61+
attribute.Expr,
62+
)
63+
}
64+
return nil
65+
})
66+
})
67+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"log"
7+
8+
hcl "github.com/hashicorp/hcl/v2"
9+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
10+
)
11+
12+
// AwsDevicefarmDevicePoolInvalidNameRule checks the pattern is valid
13+
type AwsDevicefarmDevicePoolInvalidNameRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
}
18+
19+
// NewAwsDevicefarmDevicePoolInvalidNameRule returns new rule with default attributes
20+
func NewAwsDevicefarmDevicePoolInvalidNameRule() *AwsDevicefarmDevicePoolInvalidNameRule {
21+
return &AwsDevicefarmDevicePoolInvalidNameRule{
22+
resourceType: "aws_devicefarm_device_pool",
23+
attributeName: "name",
24+
max: 256,
25+
}
26+
}
27+
28+
// Name returns the rule name
29+
func (r *AwsDevicefarmDevicePoolInvalidNameRule) Name() string {
30+
return "aws_devicefarm_device_pool_invalid_name"
31+
}
32+
33+
// Enabled returns whether the rule is enabled by default
34+
func (r *AwsDevicefarmDevicePoolInvalidNameRule) Enabled() bool {
35+
return true
36+
}
37+
38+
// Severity returns the rule severity
39+
func (r *AwsDevicefarmDevicePoolInvalidNameRule) Severity() string {
40+
return tflint.ERROR
41+
}
42+
43+
// Link returns the rule reference link
44+
func (r *AwsDevicefarmDevicePoolInvalidNameRule) Link() string {
45+
return ""
46+
}
47+
48+
// Check checks the pattern is valid
49+
func (r *AwsDevicefarmDevicePoolInvalidNameRule) Check(runner tflint.Runner) error {
50+
log.Printf("[TRACE] Check `%s` rule", r.Name())
51+
52+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
53+
var val string
54+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
55+
56+
return runner.EnsureNoError(err, func() error {
57+
if len(val) > r.max {
58+
runner.EmitIssueOnExpr(
59+
r,
60+
"name must be 256 characters or less",
61+
attribute.Expr,
62+
)
63+
}
64+
return nil
65+
})
66+
})
67+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"fmt"
7+
"log"
8+
"regexp"
9+
10+
hcl "github.com/hashicorp/hcl/v2"
11+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
12+
)
13+
14+
// AwsDevicefarmDevicePoolInvalidProjectArnRule checks the pattern is valid
15+
type AwsDevicefarmDevicePoolInvalidProjectArnRule struct {
16+
resourceType string
17+
attributeName string
18+
max int
19+
min int
20+
pattern *regexp.Regexp
21+
}
22+
23+
// NewAwsDevicefarmDevicePoolInvalidProjectArnRule returns new rule with default attributes
24+
func NewAwsDevicefarmDevicePoolInvalidProjectArnRule() *AwsDevicefarmDevicePoolInvalidProjectArnRule {
25+
return &AwsDevicefarmDevicePoolInvalidProjectArnRule{
26+
resourceType: "aws_devicefarm_device_pool",
27+
attributeName: "project_arn",
28+
max: 1011,
29+
min: 32,
30+
pattern: regexp.MustCompile(`^arn:.+`),
31+
}
32+
}
33+
34+
// Name returns the rule name
35+
func (r *AwsDevicefarmDevicePoolInvalidProjectArnRule) Name() string {
36+
return "aws_devicefarm_device_pool_invalid_project_arn"
37+
}
38+
39+
// Enabled returns whether the rule is enabled by default
40+
func (r *AwsDevicefarmDevicePoolInvalidProjectArnRule) Enabled() bool {
41+
return true
42+
}
43+
44+
// Severity returns the rule severity
45+
func (r *AwsDevicefarmDevicePoolInvalidProjectArnRule) Severity() string {
46+
return tflint.ERROR
47+
}
48+
49+
// Link returns the rule reference link
50+
func (r *AwsDevicefarmDevicePoolInvalidProjectArnRule) Link() string {
51+
return ""
52+
}
53+
54+
// Check checks the pattern is valid
55+
func (r *AwsDevicefarmDevicePoolInvalidProjectArnRule) Check(runner tflint.Runner) error {
56+
log.Printf("[TRACE] Check `%s` rule", r.Name())
57+
58+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
59+
var val string
60+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
61+
62+
return runner.EnsureNoError(err, func() error {
63+
if len(val) > r.max {
64+
runner.EmitIssueOnExpr(
65+
r,
66+
"project_arn must be 1011 characters or less",
67+
attribute.Expr,
68+
)
69+
}
70+
if len(val) < r.min {
71+
runner.EmitIssueOnExpr(
72+
r,
73+
"project_arn must be 32 characters or higher",
74+
attribute.Expr,
75+
)
76+
}
77+
if !r.pattern.MatchString(val) {
78+
runner.EmitIssueOnExpr(
79+
r,
80+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^arn:.+`),
81+
attribute.Expr,
82+
)
83+
}
84+
return nil
85+
})
86+
})
87+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"log"
7+
8+
hcl "github.com/hashicorp/hcl/v2"
9+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
10+
)
11+
12+
// AwsDevicefarmNetworkProfileInvalidDescriptionRule checks the pattern is valid
13+
type AwsDevicefarmNetworkProfileInvalidDescriptionRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
}
18+
19+
// NewAwsDevicefarmNetworkProfileInvalidDescriptionRule returns new rule with default attributes
20+
func NewAwsDevicefarmNetworkProfileInvalidDescriptionRule() *AwsDevicefarmNetworkProfileInvalidDescriptionRule {
21+
return &AwsDevicefarmNetworkProfileInvalidDescriptionRule{
22+
resourceType: "aws_devicefarm_network_profile",
23+
attributeName: "description",
24+
max: 16384,
25+
}
26+
}
27+
28+
// Name returns the rule name
29+
func (r *AwsDevicefarmNetworkProfileInvalidDescriptionRule) Name() string {
30+
return "aws_devicefarm_network_profile_invalid_description"
31+
}
32+
33+
// Enabled returns whether the rule is enabled by default
34+
func (r *AwsDevicefarmNetworkProfileInvalidDescriptionRule) Enabled() bool {
35+
return true
36+
}
37+
38+
// Severity returns the rule severity
39+
func (r *AwsDevicefarmNetworkProfileInvalidDescriptionRule) Severity() string {
40+
return tflint.ERROR
41+
}
42+
43+
// Link returns the rule reference link
44+
func (r *AwsDevicefarmNetworkProfileInvalidDescriptionRule) Link() string {
45+
return ""
46+
}
47+
48+
// Check checks the pattern is valid
49+
func (r *AwsDevicefarmNetworkProfileInvalidDescriptionRule) Check(runner tflint.Runner) error {
50+
log.Printf("[TRACE] Check `%s` rule", r.Name())
51+
52+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
53+
var val string
54+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
55+
56+
return runner.EnsureNoError(err, func() error {
57+
if len(val) > r.max {
58+
runner.EmitIssueOnExpr(
59+
r,
60+
"description must be 16384 characters or less",
61+
attribute.Expr,
62+
)
63+
}
64+
return nil
65+
})
66+
})
67+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"log"
7+
8+
hcl "github.com/hashicorp/hcl/v2"
9+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
10+
)
11+
12+
// AwsDevicefarmNetworkProfileInvalidNameRule checks the pattern is valid
13+
type AwsDevicefarmNetworkProfileInvalidNameRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
}
18+
19+
// NewAwsDevicefarmNetworkProfileInvalidNameRule returns new rule with default attributes
20+
func NewAwsDevicefarmNetworkProfileInvalidNameRule() *AwsDevicefarmNetworkProfileInvalidNameRule {
21+
return &AwsDevicefarmNetworkProfileInvalidNameRule{
22+
resourceType: "aws_devicefarm_network_profile",
23+
attributeName: "name",
24+
max: 256,
25+
}
26+
}
27+
28+
// Name returns the rule name
29+
func (r *AwsDevicefarmNetworkProfileInvalidNameRule) Name() string {
30+
return "aws_devicefarm_network_profile_invalid_name"
31+
}
32+
33+
// Enabled returns whether the rule is enabled by default
34+
func (r *AwsDevicefarmNetworkProfileInvalidNameRule) Enabled() bool {
35+
return true
36+
}
37+
38+
// Severity returns the rule severity
39+
func (r *AwsDevicefarmNetworkProfileInvalidNameRule) Severity() string {
40+
return tflint.ERROR
41+
}
42+
43+
// Link returns the rule reference link
44+
func (r *AwsDevicefarmNetworkProfileInvalidNameRule) Link() string {
45+
return ""
46+
}
47+
48+
// Check checks the pattern is valid
49+
func (r *AwsDevicefarmNetworkProfileInvalidNameRule) Check(runner tflint.Runner) error {
50+
log.Printf("[TRACE] Check `%s` rule", r.Name())
51+
52+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
53+
var val string
54+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
55+
56+
return runner.EnsureNoError(err, func() error {
57+
if len(val) > r.max {
58+
runner.EmitIssueOnExpr(
59+
r,
60+
"name must be 256 characters or less",
61+
attribute.Expr,
62+
)
63+
}
64+
return nil
65+
})
66+
})
67+
}

0 commit comments

Comments
 (0)