Skip to content

14 files changed

+924
-0
lines changed

docs/rules/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,17 @@ These rules enforce best practices and naming conventions:
837837
|aws_s3_bucket_object_invalid_acl||
838838
|aws_s3_bucket_object_invalid_server_side_encryption||
839839
|aws_s3_bucket_object_invalid_storage_class||
840+
|aws_s3control_access_point_policy_invalid_access_point_arn||
841+
|aws_s3control_bucket_invalid_bucket||
842+
|aws_s3control_bucket_invalid_outpost_id||
843+
|aws_s3control_bucket_lifecycle_configuration_invalid_bucket||
844+
|aws_s3control_bucket_policy_invalid_bucket||
845+
|aws_s3control_multi_region_access_point_invalid_account_id||
846+
|aws_s3control_multi_region_access_point_policy_invalid_account_id||
847+
|aws_s3control_object_lambda_access_point_invalid_account_id||
848+
|aws_s3control_object_lambda_access_point_invalid_name||
849+
|aws_s3control_object_lambda_access_point_policy_invalid_account_id||
850+
|aws_s3control_object_lambda_access_point_policy_invalid_name||
840851
|aws_sagemaker_app_invalid_app_name||
841852
|aws_sagemaker_app_invalid_app_type||
842853
|aws_sagemaker_app_invalid_domain_id||
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+
// AwsS3controlAccessPointPolicyInvalidAccessPointArnRule checks the pattern is valid
13+
type AwsS3controlAccessPointPolicyInvalidAccessPointArnRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsS3controlAccessPointPolicyInvalidAccessPointArnRule returns new rule with default attributes
21+
func NewAwsS3controlAccessPointPolicyInvalidAccessPointArnRule() *AwsS3controlAccessPointPolicyInvalidAccessPointArnRule {
22+
return &AwsS3controlAccessPointPolicyInvalidAccessPointArnRule{
23+
resourceType: "aws_s3control_access_point_policy",
24+
attributeName: "access_point_arn",
25+
max: 128,
26+
min: 4,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsS3controlAccessPointPolicyInvalidAccessPointArnRule) Name() string {
32+
return "aws_s3control_access_point_policy_invalid_access_point_arn"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsS3controlAccessPointPolicyInvalidAccessPointArnRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsS3controlAccessPointPolicyInvalidAccessPointArnRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsS3controlAccessPointPolicyInvalidAccessPointArnRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsS3controlAccessPointPolicyInvalidAccessPointArnRule) 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+
"access_point_arn must be 128 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"access_point_arn must be 4 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}
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+
// AwsS3controlBucketInvalidBucketRule checks the pattern is valid
13+
type AwsS3controlBucketInvalidBucketRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsS3controlBucketInvalidBucketRule returns new rule with default attributes
21+
func NewAwsS3controlBucketInvalidBucketRule() *AwsS3controlBucketInvalidBucketRule {
22+
return &AwsS3controlBucketInvalidBucketRule{
23+
resourceType: "aws_s3control_bucket",
24+
attributeName: "bucket",
25+
max: 255,
26+
min: 3,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsS3controlBucketInvalidBucketRule) Name() string {
32+
return "aws_s3control_bucket_invalid_bucket"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsS3controlBucketInvalidBucketRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsS3controlBucketInvalidBucketRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsS3controlBucketInvalidBucketRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsS3controlBucketInvalidBucketRule) 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+
"bucket must be 255 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"bucket must be 3 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}
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+
// AwsS3controlBucketInvalidOutpostIDRule checks the pattern is valid
13+
type AwsS3controlBucketInvalidOutpostIDRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsS3controlBucketInvalidOutpostIDRule returns new rule with default attributes
21+
func NewAwsS3controlBucketInvalidOutpostIDRule() *AwsS3controlBucketInvalidOutpostIDRule {
22+
return &AwsS3controlBucketInvalidOutpostIDRule{
23+
resourceType: "aws_s3control_bucket",
24+
attributeName: "outpost_id",
25+
max: 64,
26+
min: 1,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsS3controlBucketInvalidOutpostIDRule) Name() string {
32+
return "aws_s3control_bucket_invalid_outpost_id"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsS3controlBucketInvalidOutpostIDRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsS3controlBucketInvalidOutpostIDRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsS3controlBucketInvalidOutpostIDRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsS3controlBucketInvalidOutpostIDRule) 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+
"outpost_id must be 64 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"outpost_id must be 1 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}
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+
// AwsS3controlBucketLifecycleConfigurationInvalidBucketRule checks the pattern is valid
13+
type AwsS3controlBucketLifecycleConfigurationInvalidBucketRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsS3controlBucketLifecycleConfigurationInvalidBucketRule returns new rule with default attributes
21+
func NewAwsS3controlBucketLifecycleConfigurationInvalidBucketRule() *AwsS3controlBucketLifecycleConfigurationInvalidBucketRule {
22+
return &AwsS3controlBucketLifecycleConfigurationInvalidBucketRule{
23+
resourceType: "aws_s3control_bucket_lifecycle_configuration",
24+
attributeName: "bucket",
25+
max: 255,
26+
min: 3,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsS3controlBucketLifecycleConfigurationInvalidBucketRule) Name() string {
32+
return "aws_s3control_bucket_lifecycle_configuration_invalid_bucket"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsS3controlBucketLifecycleConfigurationInvalidBucketRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsS3controlBucketLifecycleConfigurationInvalidBucketRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsS3controlBucketLifecycleConfigurationInvalidBucketRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsS3controlBucketLifecycleConfigurationInvalidBucketRule) 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+
"bucket must be 255 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"bucket must be 3 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}

0 commit comments

Comments
 (0)