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/imagebuilder_component https://github.com/aws/aws-sdk-go/blob/main/models/apis/imagebuilder/2019-12-02/api-2.json * removing mapping not found in the Terraform schema
- Loading branch information
Showing
32 changed files
with
2,255 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_imagebuilder_component_invalid_change_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" | ||
) | ||
|
||
// AwsImagebuilderComponentInvalidChangeDescriptionRule checks the pattern is valid | ||
type AwsImagebuilderComponentInvalidChangeDescriptionRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
} | ||
|
||
// NewAwsImagebuilderComponentInvalidChangeDescriptionRule returns new rule with default attributes | ||
func NewAwsImagebuilderComponentInvalidChangeDescriptionRule() *AwsImagebuilderComponentInvalidChangeDescriptionRule { | ||
return &AwsImagebuilderComponentInvalidChangeDescriptionRule{ | ||
resourceType: "aws_imagebuilder_component", | ||
attributeName: "change_description", | ||
max: 1024, | ||
min: 1, | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsImagebuilderComponentInvalidChangeDescriptionRule) Name() string { | ||
return "aws_imagebuilder_component_invalid_change_description" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsImagebuilderComponentInvalidChangeDescriptionRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsImagebuilderComponentInvalidChangeDescriptionRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsImagebuilderComponentInvalidChangeDescriptionRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsImagebuilderComponentInvalidChangeDescriptionRule) 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, | ||
"change_description must be 1024 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"change_description 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,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" | ||
) | ||
|
||
// AwsImagebuilderComponentInvalidDataRule checks the pattern is valid | ||
type AwsImagebuilderComponentInvalidDataRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
pattern *regexp.Regexp | ||
} | ||
|
||
// NewAwsImagebuilderComponentInvalidDataRule returns new rule with default attributes | ||
func NewAwsImagebuilderComponentInvalidDataRule() *AwsImagebuilderComponentInvalidDataRule { | ||
return &AwsImagebuilderComponentInvalidDataRule{ | ||
resourceType: "aws_imagebuilder_component", | ||
attributeName: "data", | ||
max: 16000, | ||
min: 1, | ||
pattern: regexp.MustCompile(`^[^\x00]+$`), | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsImagebuilderComponentInvalidDataRule) Name() string { | ||
return "aws_imagebuilder_component_invalid_data" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsImagebuilderComponentInvalidDataRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsImagebuilderComponentInvalidDataRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsImagebuilderComponentInvalidDataRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsImagebuilderComponentInvalidDataRule) 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, | ||
"data must be 16000 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"data 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), `^[^\x00]+$`), | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
76 changes: 76 additions & 0 deletions
76
rules/models/aws_imagebuilder_component_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" | ||
) | ||
|
||
// AwsImagebuilderComponentInvalidDescriptionRule checks the pattern is valid | ||
type AwsImagebuilderComponentInvalidDescriptionRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
} | ||
|
||
// NewAwsImagebuilderComponentInvalidDescriptionRule returns new rule with default attributes | ||
func NewAwsImagebuilderComponentInvalidDescriptionRule() *AwsImagebuilderComponentInvalidDescriptionRule { | ||
return &AwsImagebuilderComponentInvalidDescriptionRule{ | ||
resourceType: "aws_imagebuilder_component", | ||
attributeName: "description", | ||
max: 1024, | ||
min: 1, | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsImagebuilderComponentInvalidDescriptionRule) Name() string { | ||
return "aws_imagebuilder_component_invalid_description" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsImagebuilderComponentInvalidDescriptionRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsImagebuilderComponentInvalidDescriptionRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsImagebuilderComponentInvalidDescriptionRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsImagebuilderComponentInvalidDescriptionRule) 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 1024 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"description must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
76 changes: 76 additions & 0 deletions
76
rules/models/aws_imagebuilder_component_invalid_kms_key_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" | ||
) | ||
|
||
// AwsImagebuilderComponentInvalidKmsKeyIDRule checks the pattern is valid | ||
type AwsImagebuilderComponentInvalidKmsKeyIDRule struct { | ||
resourceType string | ||
attributeName string | ||
max int | ||
min int | ||
} | ||
|
||
// NewAwsImagebuilderComponentInvalidKmsKeyIDRule returns new rule with default attributes | ||
func NewAwsImagebuilderComponentInvalidKmsKeyIDRule() *AwsImagebuilderComponentInvalidKmsKeyIDRule { | ||
return &AwsImagebuilderComponentInvalidKmsKeyIDRule{ | ||
resourceType: "aws_imagebuilder_component", | ||
attributeName: "kms_key_id", | ||
max: 1024, | ||
min: 1, | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *AwsImagebuilderComponentInvalidKmsKeyIDRule) Name() string { | ||
return "aws_imagebuilder_component_invalid_kms_key_id" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *AwsImagebuilderComponentInvalidKmsKeyIDRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *AwsImagebuilderComponentInvalidKmsKeyIDRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *AwsImagebuilderComponentInvalidKmsKeyIDRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *AwsImagebuilderComponentInvalidKmsKeyIDRule) 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, | ||
"kms_key_id must be 1024 characters or less", | ||
attribute.Expr, | ||
) | ||
} | ||
if len(val) < r.min { | ||
runner.EmitIssueOnExpr( | ||
r, | ||
"kms_key_id must be 1 characters or higher", | ||
attribute.Expr, | ||
) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
Oops, something went wrong.