Skip to content

12 files changed

+748
-0
lines changed

docs/rules/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,15 @@ These rules enforce best practices and naming conventions:
435435
|aws_config_remediation_configuration_invalid_config_rule_name||
436436
|aws_config_remediation_configuration_invalid_target_id||
437437
|aws_config_remediation_configuration_invalid_target_type||
438+
|aws_connect_bot_association_invalid_instance_id||
439+
|aws_connect_contact_flow_invalid_instance_id||
440+
|aws_connect_contact_flow_invalid_type||
441+
|aws_connect_hours_of_operation_invalid_description||
442+
|aws_connect_hours_of_operation_invalid_instance_id||
443+
|aws_connect_hours_of_operation_invalid_name||
444+
|aws_connect_instance_invalid_identity_management_type||
445+
|aws_connect_lambda_function_association_invalid_function_arn||
446+
|aws_connect_lambda_function_association_invalid_instance_id||
438447
|aws_cur_report_definition_invalid_compression||
439448
|aws_cur_report_definition_invalid_format||
440449
|aws_cur_report_definition_invalid_report_name||
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+
// AwsConnectBotAssociationInvalidInstanceIDRule checks the pattern is valid
13+
type AwsConnectBotAssociationInvalidInstanceIDRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsConnectBotAssociationInvalidInstanceIDRule returns new rule with default attributes
21+
func NewAwsConnectBotAssociationInvalidInstanceIDRule() *AwsConnectBotAssociationInvalidInstanceIDRule {
22+
return &AwsConnectBotAssociationInvalidInstanceIDRule{
23+
resourceType: "aws_connect_bot_association",
24+
attributeName: "instance_id",
25+
max: 100,
26+
min: 1,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Name() string {
32+
return "aws_connect_bot_association_invalid_instance_id"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) 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+
"instance_id must be 100 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"instance_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+
// AwsConnectContactFlowInvalidInstanceIDRule checks the pattern is valid
13+
type AwsConnectContactFlowInvalidInstanceIDRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsConnectContactFlowInvalidInstanceIDRule returns new rule with default attributes
21+
func NewAwsConnectContactFlowInvalidInstanceIDRule() *AwsConnectContactFlowInvalidInstanceIDRule {
22+
return &AwsConnectContactFlowInvalidInstanceIDRule{
23+
resourceType: "aws_connect_contact_flow",
24+
attributeName: "instance_id",
25+
max: 100,
26+
min: 1,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Name() string {
32+
return "aws_connect_contact_flow_invalid_instance_id"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsConnectContactFlowInvalidInstanceIDRule) 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+
"instance_id must be 100 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"instance_id must be 1 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"fmt"
7+
"log"
8+
9+
hcl "github.com/hashicorp/hcl/v2"
10+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
11+
)
12+
13+
// AwsConnectContactFlowInvalidTypeRule checks the pattern is valid
14+
type AwsConnectContactFlowInvalidTypeRule struct {
15+
resourceType string
16+
attributeName string
17+
enum []string
18+
}
19+
20+
// NewAwsConnectContactFlowInvalidTypeRule returns new rule with default attributes
21+
func NewAwsConnectContactFlowInvalidTypeRule() *AwsConnectContactFlowInvalidTypeRule {
22+
return &AwsConnectContactFlowInvalidTypeRule{
23+
resourceType: "aws_connect_contact_flow",
24+
attributeName: "type",
25+
enum: []string{
26+
"CONTACT_FLOW",
27+
"CUSTOMER_QUEUE",
28+
"CUSTOMER_HOLD",
29+
"CUSTOMER_WHISPER",
30+
"AGENT_HOLD",
31+
"AGENT_WHISPER",
32+
"OUTBOUND_WHISPER",
33+
"AGENT_TRANSFER",
34+
"QUEUE_TRANSFER",
35+
},
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *AwsConnectContactFlowInvalidTypeRule) Name() string {
41+
return "aws_connect_contact_flow_invalid_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *AwsConnectContactFlowInvalidTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *AwsConnectContactFlowInvalidTypeRule) Severity() string {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *AwsConnectContactFlowInvalidTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *AwsConnectContactFlowInvalidTypeRule) Check(runner tflint.Runner) error {
61+
log.Printf("[TRACE] Check `%s` rule", r.Name())
62+
63+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
64+
var val string
65+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
66+
67+
return runner.EnsureNoError(err, func() error {
68+
found := false
69+
for _, item := range r.enum {
70+
if item == val {
71+
found = true
72+
}
73+
}
74+
if !found {
75+
runner.EmitIssueOnExpr(
76+
r,
77+
fmt.Sprintf(`"%s" is an invalid value as type`, truncateLongMessage(val)),
78+
attribute.Expr,
79+
)
80+
}
81+
return nil
82+
})
83+
})
84+
}
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+
// AwsConnectHoursOfOperationInvalidDescriptionRule checks the pattern is valid
13+
type AwsConnectHoursOfOperationInvalidDescriptionRule struct {
14+
resourceType string
15+
attributeName string
16+
max int
17+
min int
18+
}
19+
20+
// NewAwsConnectHoursOfOperationInvalidDescriptionRule returns new rule with default attributes
21+
func NewAwsConnectHoursOfOperationInvalidDescriptionRule() *AwsConnectHoursOfOperationInvalidDescriptionRule {
22+
return &AwsConnectHoursOfOperationInvalidDescriptionRule{
23+
resourceType: "aws_connect_hours_of_operation",
24+
attributeName: "description",
25+
max: 250,
26+
min: 1,
27+
}
28+
}
29+
30+
// Name returns the rule name
31+
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Name() string {
32+
return "aws_connect_hours_of_operation_invalid_description"
33+
}
34+
35+
// Enabled returns whether the rule is enabled by default
36+
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Enabled() bool {
37+
return true
38+
}
39+
40+
// Severity returns the rule severity
41+
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Severity() string {
42+
return tflint.ERROR
43+
}
44+
45+
// Link returns the rule reference link
46+
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Link() string {
47+
return ""
48+
}
49+
50+
// Check checks the pattern is valid
51+
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) 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+
"description must be 250 characters or less",
63+
attribute.Expr,
64+
)
65+
}
66+
if len(val) < r.min {
67+
runner.EmitIssueOnExpr(
68+
r,
69+
"description must be 1 characters or higher",
70+
attribute.Expr,
71+
)
72+
}
73+
return nil
74+
})
75+
})
76+
}

0 commit comments

Comments
 (0)