generated from terraform-linters/tflint-ruleset-template
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
712 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
rules/models/aws_connect_bot_association_invalid_instance_id.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"log" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsConnectBotAssociationInvalidInstanceIDRule checks the pattern is valid | ||
type AwsConnectBotAssociationInvalidInstanceIDRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
} | ||
|
||
// NewAwsConnectBotAssociationInvalidInstanceIDRule returns new rule with default attributes | ||
func NewAwsConnectBotAssociationInvalidInstanceIDRule() *AwsConnectBotAssociationInvalidInstanceIDRule { | ||
return &AwsConnectBotAssociationInvalidInstanceIDRule{ | ||
resourceType: "aws_connect_bot_association", | ||
attributeName: "instance_id", | ||
max: 100, | ||
min: 1, | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Name() string { | ||
return "aws_connect_bot_association_invalid_instance_id" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsConnectBotAssociationInvalidInstanceIDRule) Check(runner tflint.Runner) error { | ||
log.Printf("[TRACE] Check `%s` rule", r.Name()) | ||
|
||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val, nil) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
if len(val) > r.max { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"instance_id must be 100 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"instance_id must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
76 changes: 76 additions & 0 deletions
76
rules/models/aws_connect_contact_flow_invalid_instance_id.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"log" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsConnectContactFlowInvalidInstanceIDRule checks the pattern is valid | ||
type AwsConnectContactFlowInvalidInstanceIDRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
} | ||
|
||
// NewAwsConnectContactFlowInvalidInstanceIDRule returns new rule with default attributes | ||
func NewAwsConnectContactFlowInvalidInstanceIDRule() *AwsConnectContactFlowInvalidInstanceIDRule { | ||
return &AwsConnectContactFlowInvalidInstanceIDRule{ | ||
resourceType: "aws_connect_contact_flow", | ||
attributeName: "instance_id", | ||
max: 100, | ||
min: 1, | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Name() string { | ||
return "aws_connect_contact_flow_invalid_instance_id" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsConnectContactFlowInvalidInstanceIDRule) Check(runner tflint.Runner) error { | ||
log.Printf("[TRACE] Check `%s` rule", r.Name()) | ||
|
||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val, nil) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
if len(val) > r.max { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"instance_id must be 100 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"instance_id must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsConnectContactFlowInvalidTypeRule checks the pattern is valid | ||
type AwsConnectContactFlowInvalidTypeRule struct { | ||
resourceType string | ||
attributeName string | ||
enum []string | ||
} | ||
|
||
// NewAwsConnectContactFlowInvalidTypeRule returns new rule with default attributes | ||
func NewAwsConnectContactFlowInvalidTypeRule() *AwsConnectContactFlowInvalidTypeRule { | ||
return &AwsConnectContactFlowInvalidTypeRule{ | ||
resourceType: "aws_connect_contact_flow", | ||
attributeName: "type", | ||
enum: []string{ | ||
"CONTACT_FLOW", | ||
"CUSTOMER_QUEUE", | ||
"CUSTOMER_HOLD", | ||
"CUSTOMER_WHISPER", | ||
"AGENT_HOLD", | ||
"AGENT_WHISPER", | ||
"OUTBOUND_WHISPER", | ||
"AGENT_TRANSFER", | ||
"QUEUE_TRANSFER", | ||
}, | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsConnectContactFlowInvalidTypeRule) Name() string { | ||
return "aws_connect_contact_flow_invalid_type" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsConnectContactFlowInvalidTypeRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsConnectContactFlowInvalidTypeRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsConnectContactFlowInvalidTypeRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsConnectContactFlowInvalidTypeRule) Check(runner tflint.Runner) error { | ||
log.Printf("[TRACE] Check `%s` rule", r.Name()) | ||
|
||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val, nil) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
found := false | ||
for _, item := range r.enum { | ||
if item == val { | ||
found = true | ||
} | ||
} | ||
if !found { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
fmt.Sprintf(`"%s" is an invalid value as type`, truncateLongMessage(val)), | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
76 changes: 76 additions & 0 deletions
76
rules/models/aws_connect_hours_of_operation_invalid_description.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"log" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsConnectHoursOfOperationInvalidDescriptionRule checks the pattern is valid | ||
type AwsConnectHoursOfOperationInvalidDescriptionRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
} | ||
|
||
// NewAwsConnectHoursOfOperationInvalidDescriptionRule returns new rule with default attributes | ||
func NewAwsConnectHoursOfOperationInvalidDescriptionRule() *AwsConnectHoursOfOperationInvalidDescriptionRule { | ||
return &AwsConnectHoursOfOperationInvalidDescriptionRule{ | ||
resourceType: "aws_connect_hours_of_operation", | ||
attributeName: "description", | ||
max: 250, | ||
min: 1, | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Name() string { | ||
return "aws_connect_hours_of_operation_invalid_description" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsConnectHoursOfOperationInvalidDescriptionRule) Check(runner tflint.Runner) error { | ||
log.Printf("[TRACE] Check `%s` rule", r.Name()) | ||
|
||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val, nil) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
if len(val) > r.max { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"description must be 250 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"description must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
Oops, something went wrong.