Skip to content

9 files changed

+460
-0
lines changed

docs/rules/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,12 @@ These rules enforce best practices and naming conventions:
10791079
|aws_sagemaker_workteam_invalid_description||
10801080
|aws_sagemaker_workteam_invalid_workforce_name||
10811081
|aws_sagemaker_workteam_invalid_workteam_name||
1082+
|aws_schemas_discoverer_invalid_description||
1083+
|aws_schemas_discoverer_invalid_source_arn||
1084+
|aws_schemas_registry_invalid_description||
1085+
|aws_schemas_schema_invalid_content||
1086+
|aws_schemas_schema_invalid_description||
1087+
|aws_schemas_schema_invalid_type||
10821088
|aws_secretsmanager_secret_invalid_description||
10831089
|aws_secretsmanager_secret_invalid_kms_key_id||
10841090
|aws_secretsmanager_secret_invalid_name||
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+
// AwsSchemasDiscovererInvalidDescriptionRule checks the pattern is valid
13+
type AwsSchemasDiscovererInvalidDescriptionRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
}
18+
19+
// NewAwsSchemasDiscovererInvalidDescriptionRule returns new rule with default attributes
20+
func NewAwsSchemasDiscovererInvalidDescriptionRule() *AwsSchemasDiscovererInvalidDescriptionRule {
21+
return &AwsSchemasDiscovererInvalidDescriptionRule{
22+
resourceType: "aws_schemas_discoverer",
23+
attributeName: "description",
24+
max: 256,
25+
}
26+
}
27+
28+
// Name returns the rule name
29+
func (r *AwsSchemasDiscovererInvalidDescriptionRule) Name() string {
30+
return "aws_schemas_discoverer_invalid_description"
31+
}
32+
33+
// Enabled returns whether the rule is enabled by default
34+
func (r *AwsSchemasDiscovererInvalidDescriptionRule) Enabled() bool {
35+
return true
36+
}
37+
38+
// Severity returns the rule severity
39+
func (r *AwsSchemasDiscovererInvalidDescriptionRule) Severity() string {
40+
return tflint.ERROR
41+
}
42+
43+
// Link returns the rule reference link
44+
func (r *AwsSchemasDiscovererInvalidDescriptionRule) Link() string {
45+
return ""
46+
}
47+
48+
// Check checks the pattern is valid
49+
func (r *AwsSchemasDiscovererInvalidDescriptionRule) 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 256 characters or less",
61+
attribute.Expr,
62+
)
63+
}
64+
return nil
65+
})
66+
})
67+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
// AwsSchemasDiscovererInvalidSourceArnRule checks the pattern is valid
13+
type AwsSchemasDiscovererInvalidSourceArnRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsSchemasDiscovererInvalidSourceArnRule returns new rule with default attributes
21+
func NewAwsSchemasDiscovererInvalidSourceArnRule() *AwsSchemasDiscovererInvalidSourceArnRule {
22+
return &AwsSchemasDiscovererInvalidSourceArnRule{
23+
resourceType: "aws_schemas_discoverer",
24+
attributeName: "source_arn",
25+
max: 1600,
26+
min: 20,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsSchemasDiscovererInvalidSourceArnRule) Name() string {
32+
return "aws_schemas_discoverer_invalid_source_arn"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsSchemasDiscovererInvalidSourceArnRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsSchemasDiscovererInvalidSourceArnRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsSchemasDiscovererInvalidSourceArnRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsSchemasDiscovererInvalidSourceArnRule) Check(runner tflint.Runner) error {
52+
log.Printf("[TRACE] Check `%s` rule", r.Name())
53+
54+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
55+
var val string
56+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
57+
58+
return runner.EnsureNoError(err, func() error {
59+
if len(val) > r.max {
60+
runner.EmitIssueOnExpr(
61+
r,
62+
"source_arn must be 1600 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"source_arn must be 20 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}
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+
// AwsSchemasRegistryInvalidDescriptionRule checks the pattern is valid
13+
type AwsSchemasRegistryInvalidDescriptionRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
}
18+
19+
// NewAwsSchemasRegistryInvalidDescriptionRule returns new rule with default attributes
20+
func NewAwsSchemasRegistryInvalidDescriptionRule() *AwsSchemasRegistryInvalidDescriptionRule {
21+
return &AwsSchemasRegistryInvalidDescriptionRule{
22+
resourceType: "aws_schemas_registry",
23+
attributeName: "description",
24+
max: 256,
25+
}
26+
}
27+
28+
// Name returns the rule name
29+
func (r *AwsSchemasRegistryInvalidDescriptionRule) Name() string {
30+
return "aws_schemas_registry_invalid_description"
31+
}
32+
33+
// Enabled returns whether the rule is enabled by default
34+
func (r *AwsSchemasRegistryInvalidDescriptionRule) Enabled() bool {
35+
return true
36+
}
37+
38+
// Severity returns the rule severity
39+
func (r *AwsSchemasRegistryInvalidDescriptionRule) Severity() string {
40+
return tflint.ERROR
41+
}
42+
43+
// Link returns the rule reference link
44+
func (r *AwsSchemasRegistryInvalidDescriptionRule) Link() string {
45+
return ""
46+
}
47+
48+
// Check checks the pattern is valid
49+
func (r *AwsSchemasRegistryInvalidDescriptionRule) 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 256 characters or less",
61+
attribute.Expr,
62+
)
63+
}
64+
return nil
65+
})
66+
})
67+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
// AwsSchemasSchemaInvalidContentRule checks the pattern is valid
13+
type AwsSchemasSchemaInvalidContentRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsSchemasSchemaInvalidContentRule returns new rule with default attributes
21+
func NewAwsSchemasSchemaInvalidContentRule() *AwsSchemasSchemaInvalidContentRule {
22+
return &AwsSchemasSchemaInvalidContentRule{
23+
resourceType: "aws_schemas_schema",
24+
attributeName: "content",
25+
max: 100000,
26+
min: 1,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsSchemasSchemaInvalidContentRule) Name() string {
32+
return "aws_schemas_schema_invalid_content"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsSchemasSchemaInvalidContentRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsSchemasSchemaInvalidContentRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsSchemasSchemaInvalidContentRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsSchemasSchemaInvalidContentRule) Check(runner tflint.Runner) error {
52+
log.Printf("[TRACE] Check `%s` rule", r.Name())
53+
54+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
55+
var val string
56+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
57+
58+
return runner.EnsureNoError(err, func() error {
59+
if len(val) > r.max {
60+
runner.EmitIssueOnExpr(
61+
r,
62+
"content must be 100000 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"content must be 1 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}
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+
// AwsSchemasSchemaInvalidDescriptionRule checks the pattern is valid
13+
type AwsSchemasSchemaInvalidDescriptionRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
}
18+
19+
// NewAwsSchemasSchemaInvalidDescriptionRule returns new rule with default attributes
20+
func NewAwsSchemasSchemaInvalidDescriptionRule() *AwsSchemasSchemaInvalidDescriptionRule {
21+
return &AwsSchemasSchemaInvalidDescriptionRule{
22+
resourceType: "aws_schemas_schema",
23+
attributeName: "description",
24+
max: 256,
25+
}
26+
}
27+
28+
// Name returns the rule name
29+
func (r *AwsSchemasSchemaInvalidDescriptionRule) Name() string {
30+
return "aws_schemas_schema_invalid_description"
31+
}
32+
33+
// Enabled returns whether the rule is enabled by default
34+
func (r *AwsSchemasSchemaInvalidDescriptionRule) Enabled() bool {
35+
return true
36+
}
37+
38+
// Severity returns the rule severity
39+
func (r *AwsSchemasSchemaInvalidDescriptionRule) Severity() string {
40+
return tflint.ERROR
41+
}
42+
43+
// Link returns the rule reference link
44+
func (r *AwsSchemasSchemaInvalidDescriptionRule) Link() string {
45+
return ""
46+
}
47+
48+
// Check checks the pattern is valid
49+
func (r *AwsSchemasSchemaInvalidDescriptionRule) 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 256 characters or less",
61+
attribute.Expr,
62+
)
63+
}
64+
return nil
65+
})
66+
})
67+
}

0 commit comments

Comments
 (0)