generated from terraform-linters/tflint-ruleset-template
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/networkfirewall_firewall https://github.com/aws/aws-sdk-go/blob/main/models/apis/network-firewall/2020-11-12/api-2.json
- Loading branch information
Showing
16 changed files
with
1,137 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
78 changes: 78 additions & 0 deletions
78
rules/models/aws_networkfirewall_firewall_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,78 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"regexp" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsNetworkfirewallFirewallInvalidDescriptionRule checks the pattern is valid | ||
type AwsNetworkfirewallFirewallInvalidDescriptionRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
pattern *regexp.Regexp | ||
} | ||
|
||
// NewAwsNetworkfirewallFirewallInvalidDescriptionRule returns new rule with default attributes | ||
func NewAwsNetworkfirewallFirewallInvalidDescriptionRule() *AwsNetworkfirewallFirewallInvalidDescriptionRule { | ||
return &AwsNetworkfirewallFirewallInvalidDescriptionRule{ | ||
resourceType: "aws_networkfirewall_firewall", | ||
attributeName: "description", | ||
max: 512, | ||
pattern: regexp.MustCompile(`^.*$`), | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsNetworkfirewallFirewallInvalidDescriptionRule) Name() string { | ||
return "aws_networkfirewall_firewall_invalid_description" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsNetworkfirewallFirewallInvalidDescriptionRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsNetworkfirewallFirewallInvalidDescriptionRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsNetworkfirewallFirewallInvalidDescriptionRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsNetworkfirewallFirewallInvalidDescriptionRule) 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 512 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if !r.pattern.MatchString(val) { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*$`), | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
87 changes: 87 additions & 0 deletions
87
rules/models/aws_networkfirewall_firewall_invalid_firewall_policy_arn.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,87 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"regexp" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule checks the pattern is valid | ||
type AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
pattern *regexp.Regexp | ||
} | ||
|
||
// NewAwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule returns new rule with default attributes | ||
func NewAwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule() *AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule { | ||
return &AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule{ | ||
resourceType: "aws_networkfirewall_firewall", | ||
attributeName: "firewall_policy_arn", | ||
max: 256, | ||
min: 1, | ||
pattern: regexp.MustCompile(`^arn:aws.*`), | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule) Name() string { | ||
return "aws_networkfirewall_firewall_invalid_firewall_policy_arn" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsNetworkfirewallFirewallInvalidFirewallPolicyArnRule) 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, | ||
"firewall_policy_arn must be 256 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"firewall_policy_arn must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
if !r.pattern.MatchString(val) { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^arn:aws.*`), | ||
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,87 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"regexp" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsNetworkfirewallFirewallInvalidNameRule checks the pattern is valid | ||
type AwsNetworkfirewallFirewallInvalidNameRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
pattern *regexp.Regexp | ||
} | ||
|
||
// NewAwsNetworkfirewallFirewallInvalidNameRule returns new rule with default attributes | ||
func NewAwsNetworkfirewallFirewallInvalidNameRule() *AwsNetworkfirewallFirewallInvalidNameRule { | ||
return &AwsNetworkfirewallFirewallInvalidNameRule{ | ||
resourceType: "aws_networkfirewall_firewall", | ||
attributeName: "name", | ||
max: 128, | ||
min: 1, | ||
pattern: regexp.MustCompile(`^[a-zA-Z0-9-]+$`), | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsNetworkfirewallFirewallInvalidNameRule) Name() string { | ||
return "aws_networkfirewall_firewall_invalid_name" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsNetworkfirewallFirewallInvalidNameRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsNetworkfirewallFirewallInvalidNameRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsNetworkfirewallFirewallInvalidNameRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsNetworkfirewallFirewallInvalidNameRule) 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, | ||
"name must be 128 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"name must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
if !r.pattern.MatchString(val) { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^[a-zA-Z0-9-]+$`), | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
87 changes: 87 additions & 0 deletions
87
rules/models/aws_networkfirewall_firewall_invalid_vpc_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,87 @@ | ||
// This file generated by `generator/`. DO NOT EDIT | ||
|
||
package models | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"regexp" | ||
|
||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// AwsNetworkfirewallFirewallInvalidVpcIDRule checks the pattern is valid | ||
type AwsNetworkfirewallFirewallInvalidVpcIDRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
pattern *regexp.Regexp | ||
} | ||
|
||
// NewAwsNetworkfirewallFirewallInvalidVpcIDRule returns new rule with default attributes | ||
func NewAwsNetworkfirewallFirewallInvalidVpcIDRule() *AwsNetworkfirewallFirewallInvalidVpcIDRule { | ||
return &AwsNetworkfirewallFirewallInvalidVpcIDRule{ | ||
resourceType: "aws_networkfirewall_firewall", | ||
attributeName: "vpc_id", | ||
max: 128, | ||
min: 1, | ||
pattern: regexp.MustCompile(`^vpc-[0-9a-f]+$`), | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsNetworkfirewallFirewallInvalidVpcIDRule) Name() string { | ||
return "aws_networkfirewall_firewall_invalid_vpc_id" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsNetworkfirewallFirewallInvalidVpcIDRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsNetworkfirewallFirewallInvalidVpcIDRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsNetworkfirewallFirewallInvalidVpcIDRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsNetworkfirewallFirewallInvalidVpcIDRule) 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, | ||
"vpc_id must be 128 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"vpc_id must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
if !r.pattern.MatchString(val) { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^vpc-[0-9a-f]+$`), | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
Oops, something went wrong.