Skip to content

15 files changed

+896
-0
lines changed

docs/rules/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,19 @@ These rules enforce best practices and naming conventions:
893893
|aws_secretsmanager_secret_invalid_rotation_lambda_arn||
894894
|aws_secretsmanager_secret_version_invalid_secret_id||
895895
|aws_secretsmanager_secret_version_invalid_secret_string||
896+
|aws_securityhub_action_target_invalid_description||
897+
|aws_securityhub_action_target_invalid_identifier||
898+
|aws_securityhub_action_target_invalid_name||
899+
|aws_securityhub_finding_aggregator_invalid_linking_mode||
900+
|aws_securityhub_insight_invalid_group_by_attribute||
901+
|aws_securityhub_insight_invalid_name||
902+
|aws_securityhub_invite_accepter_invalid_master_id||
903+
|aws_securityhub_member_invalid_email||
904+
|aws_securityhub_organization_admin_account_invalid_admin_account_id||
896905
|aws_securityhub_product_subscription_invalid_product_arn||
906+
|aws_securityhub_standards_control_invalid_control_status||
907+
|aws_securityhub_standards_control_invalid_disabled_reason||
908+
|aws_securityhub_standards_control_invalid_standards_control_arn||
897909
|aws_securityhub_standards_subscription_invalid_standards_arn||
898910
|aws_service_discovery_http_namespace_invalid_description||
899911
|aws_service_discovery_http_namespace_invalid_name||
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
// AwsSecurityhubActionTargetInvalidDescriptionRule checks the pattern is valid
15+
type AwsSecurityhubActionTargetInvalidDescriptionRule struct {
16+
resourceType string
17+
attributeName string
18+
pattern *regexp.Regexp
19+
}
20+
21+
// NewAwsSecurityhubActionTargetInvalidDescriptionRule returns new rule with default attributes
22+
func NewAwsSecurityhubActionTargetInvalidDescriptionRule() *AwsSecurityhubActionTargetInvalidDescriptionRule {
23+
return &AwsSecurityhubActionTargetInvalidDescriptionRule{
24+
resourceType: "aws_securityhub_action_target",
25+
attributeName: "description",
26+
pattern: regexp.MustCompile(`^.*\S.*$`),
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsSecurityhubActionTargetInvalidDescriptionRule) Name() string {
32+
return "aws_securityhub_action_target_invalid_description"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsSecurityhubActionTargetInvalidDescriptionRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsSecurityhubActionTargetInvalidDescriptionRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsSecurityhubActionTargetInvalidDescriptionRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsSecurityhubActionTargetInvalidDescriptionRule) 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 !r.pattern.MatchString(val) {
60+
runner.EmitIssueOnExpr(
61+
r,
62+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*\S.*$`),
63+
attribute.Expr,
64+
)
65+
}
66+
return nil
67+
})
68+
})
69+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
// AwsSecurityhubActionTargetInvalidIdentifierRule checks the pattern is valid
15+
type AwsSecurityhubActionTargetInvalidIdentifierRule struct {
16+
resourceType string
17+
attributeName string
18+
pattern *regexp.Regexp
19+
}
20+
21+
// NewAwsSecurityhubActionTargetInvalidIdentifierRule returns new rule with default attributes
22+
func NewAwsSecurityhubActionTargetInvalidIdentifierRule() *AwsSecurityhubActionTargetInvalidIdentifierRule {
23+
return &AwsSecurityhubActionTargetInvalidIdentifierRule{
24+
resourceType: "aws_securityhub_action_target",
25+
attributeName: "identifier",
26+
pattern: regexp.MustCompile(`^.*\S.*$`),
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsSecurityhubActionTargetInvalidIdentifierRule) Name() string {
32+
return "aws_securityhub_action_target_invalid_identifier"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsSecurityhubActionTargetInvalidIdentifierRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsSecurityhubActionTargetInvalidIdentifierRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsSecurityhubActionTargetInvalidIdentifierRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsSecurityhubActionTargetInvalidIdentifierRule) 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 !r.pattern.MatchString(val) {
60+
runner.EmitIssueOnExpr(
61+
r,
62+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*\S.*$`),
63+
attribute.Expr,
64+
)
65+
}
66+
return nil
67+
})
68+
})
69+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
// AwsSecurityhubActionTargetInvalidNameRule checks the pattern is valid
15+
type AwsSecurityhubActionTargetInvalidNameRule struct {
16+
resourceType string
17+
attributeName string
18+
pattern *regexp.Regexp
19+
}
20+
21+
// NewAwsSecurityhubActionTargetInvalidNameRule returns new rule with default attributes
22+
func NewAwsSecurityhubActionTargetInvalidNameRule() *AwsSecurityhubActionTargetInvalidNameRule {
23+
return &AwsSecurityhubActionTargetInvalidNameRule{
24+
resourceType: "aws_securityhub_action_target",
25+
attributeName: "name",
26+
pattern: regexp.MustCompile(`^.*\S.*$`),
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsSecurityhubActionTargetInvalidNameRule) Name() string {
32+
return "aws_securityhub_action_target_invalid_name"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsSecurityhubActionTargetInvalidNameRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsSecurityhubActionTargetInvalidNameRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsSecurityhubActionTargetInvalidNameRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsSecurityhubActionTargetInvalidNameRule) 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 !r.pattern.MatchString(val) {
60+
runner.EmitIssueOnExpr(
61+
r,
62+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*\S.*$`),
63+
attribute.Expr,
64+
)
65+
}
66+
return nil
67+
})
68+
})
69+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
// AwsSecurityhubFindingAggregatorInvalidLinkingModeRule checks the pattern is valid
15+
type AwsSecurityhubFindingAggregatorInvalidLinkingModeRule struct {
16+
resourceType string
17+
attributeName string
18+
pattern *regexp.Regexp
19+
}
20+
21+
// NewAwsSecurityhubFindingAggregatorInvalidLinkingModeRule returns new rule with default attributes
22+
func NewAwsSecurityhubFindingAggregatorInvalidLinkingModeRule() *AwsSecurityhubFindingAggregatorInvalidLinkingModeRule {
23+
return &AwsSecurityhubFindingAggregatorInvalidLinkingModeRule{
24+
resourceType: "aws_securityhub_finding_aggregator",
25+
attributeName: "linking_mode",
26+
pattern: regexp.MustCompile(`^.*\S.*$`),
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsSecurityhubFindingAggregatorInvalidLinkingModeRule) Name() string {
32+
return "aws_securityhub_finding_aggregator_invalid_linking_mode"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsSecurityhubFindingAggregatorInvalidLinkingModeRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsSecurityhubFindingAggregatorInvalidLinkingModeRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsSecurityhubFindingAggregatorInvalidLinkingModeRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsSecurityhubFindingAggregatorInvalidLinkingModeRule) 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 !r.pattern.MatchString(val) {
60+
runner.EmitIssueOnExpr(
61+
r,
62+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*\S.*$`),
63+
attribute.Expr,
64+
)
65+
}
66+
return nil
67+
})
68+
})
69+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
// AwsSecurityhubInsightInvalidGroupByAttributeRule checks the pattern is valid
15+
type AwsSecurityhubInsightInvalidGroupByAttributeRule struct {
16+
resourceType string
17+
attributeName string
18+
pattern *regexp.Regexp
19+
}
20+
21+
// NewAwsSecurityhubInsightInvalidGroupByAttributeRule returns new rule with default attributes
22+
func NewAwsSecurityhubInsightInvalidGroupByAttributeRule() *AwsSecurityhubInsightInvalidGroupByAttributeRule {
23+
return &AwsSecurityhubInsightInvalidGroupByAttributeRule{
24+
resourceType: "aws_securityhub_insight",
25+
attributeName: "group_by_attribute",
26+
pattern: regexp.MustCompile(`^.*\S.*$`),
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsSecurityhubInsightInvalidGroupByAttributeRule) Name() string {
32+
return "aws_securityhub_insight_invalid_group_by_attribute"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsSecurityhubInsightInvalidGroupByAttributeRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsSecurityhubInsightInvalidGroupByAttributeRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsSecurityhubInsightInvalidGroupByAttributeRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsSecurityhubInsightInvalidGroupByAttributeRule) 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 !r.pattern.MatchString(val) {
60+
runner.EmitIssueOnExpr(
61+
r,
62+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*\S.*$`),
63+
attribute.Expr,
64+
)
65+
}
66+
return nil
67+
})
68+
})
69+
}

0 commit comments

Comments
 (0)