diff --git a/docs/rules/README.md b/docs/rules/README.md index f7864420..608d8196 100644 --- a/docs/rules/README.md +++ b/docs/rules/README.md @@ -201,6 +201,25 @@ These rules enforce best practices and naming conventions: |aws_apprunner_connection_invalid_provider_type|✔| |aws_apprunner_custom_domain_association_invalid_domain_name|✔| |aws_apprunner_service_invalid_service_name|✔| +|aws_appstream_fleet_invalid_description|✔| +|aws_appstream_fleet_invalid_display_name|✔| +|aws_appstream_fleet_invalid_fleet_type|✔| +|aws_appstream_fleet_invalid_name|✔| +|aws_appstream_fleet_invalid_stream_view|✔| +|aws_appstream_image_builder_invalid_appstream_agent_version|✔| +|aws_appstream_image_builder_invalid_description|✔| +|aws_appstream_image_builder_invalid_display_name|✔| +|aws_appstream_image_builder_invalid_name|✔| +|aws_appstream_stack_invalid_description|✔| +|aws_appstream_stack_invalid_display_name|✔| +|aws_appstream_stack_invalid_feedback_url|✔| +|aws_appstream_stack_invalid_redirect_url|✔| +|aws_appstream_user_invalid_authentication_type|✔| +|aws_appstream_user_invalid_first_name|✔| +|aws_appstream_user_invalid_last_name|✔| +|aws_appstream_user_invalid_user_name|✔| +|aws_appstream_user_stack_association_invalid_authentication_type|✔| +|aws_appstream_user_stack_association_invalid_user_name|✔| |aws_appsync_datasource_invalid_name|✔| |aws_appsync_datasource_invalid_type|✔| |aws_appsync_function_invalid_data_source|✔| diff --git a/rules/models/aws_appstream_fleet_invalid_description.go b/rules/models/aws_appstream_fleet_invalid_description.go new file mode 100644 index 00000000..e415d4cb --- /dev/null +++ b/rules/models/aws_appstream_fleet_invalid_description.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamFleetInvalidDescriptionRule checks the pattern is valid +type AwsAppstreamFleetInvalidDescriptionRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamFleetInvalidDescriptionRule returns new rule with default attributes +func NewAwsAppstreamFleetInvalidDescriptionRule() *AwsAppstreamFleetInvalidDescriptionRule { + return &AwsAppstreamFleetInvalidDescriptionRule{ + resourceType: "aws_appstream_fleet", + attributeName: "description", + max: 256, + } +} + +// Name returns the rule name +func (r *AwsAppstreamFleetInvalidDescriptionRule) Name() string { + return "aws_appstream_fleet_invalid_description" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamFleetInvalidDescriptionRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamFleetInvalidDescriptionRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamFleetInvalidDescriptionRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamFleetInvalidDescriptionRule) 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 256 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_fleet_invalid_display_name.go b/rules/models/aws_appstream_fleet_invalid_display_name.go new file mode 100644 index 00000000..b3fa9e54 --- /dev/null +++ b/rules/models/aws_appstream_fleet_invalid_display_name.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamFleetInvalidDisplayNameRule checks the pattern is valid +type AwsAppstreamFleetInvalidDisplayNameRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamFleetInvalidDisplayNameRule returns new rule with default attributes +func NewAwsAppstreamFleetInvalidDisplayNameRule() *AwsAppstreamFleetInvalidDisplayNameRule { + return &AwsAppstreamFleetInvalidDisplayNameRule{ + resourceType: "aws_appstream_fleet", + attributeName: "display_name", + max: 100, + } +} + +// Name returns the rule name +func (r *AwsAppstreamFleetInvalidDisplayNameRule) Name() string { + return "aws_appstream_fleet_invalid_display_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamFleetInvalidDisplayNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamFleetInvalidDisplayNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamFleetInvalidDisplayNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamFleetInvalidDisplayNameRule) 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, + "display_name must be 100 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_fleet_invalid_fleet_type.go b/rules/models/aws_appstream_fleet_invalid_fleet_type.go new file mode 100644 index 00000000..2544cf4a --- /dev/null +++ b/rules/models/aws_appstream_fleet_invalid_fleet_type.go @@ -0,0 +1,78 @@ +// 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" +) + +// AwsAppstreamFleetInvalidFleetTypeRule checks the pattern is valid +type AwsAppstreamFleetInvalidFleetTypeRule struct { + resourceType string + attributeName string + enum []string +} + +// NewAwsAppstreamFleetInvalidFleetTypeRule returns new rule with default attributes +func NewAwsAppstreamFleetInvalidFleetTypeRule() *AwsAppstreamFleetInvalidFleetTypeRule { + return &AwsAppstreamFleetInvalidFleetTypeRule{ + resourceType: "aws_appstream_fleet", + attributeName: "fleet_type", + enum: []string{ + "ALWAYS_ON", + "ON_DEMAND", + "ELASTIC", + }, + } +} + +// Name returns the rule name +func (r *AwsAppstreamFleetInvalidFleetTypeRule) Name() string { + return "aws_appstream_fleet_invalid_fleet_type" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamFleetInvalidFleetTypeRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamFleetInvalidFleetTypeRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamFleetInvalidFleetTypeRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamFleetInvalidFleetTypeRule) 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 fleet_type`, truncateLongMessage(val)), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_fleet_invalid_name.go b/rules/models/aws_appstream_fleet_invalid_name.go new file mode 100644 index 00000000..c0afab32 --- /dev/null +++ b/rules/models/aws_appstream_fleet_invalid_name.go @@ -0,0 +1,69 @@ +// 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" +) + +// AwsAppstreamFleetInvalidNameRule checks the pattern is valid +type AwsAppstreamFleetInvalidNameRule struct { + resourceType string + attributeName string + pattern *regexp.Regexp +} + +// NewAwsAppstreamFleetInvalidNameRule returns new rule with default attributes +func NewAwsAppstreamFleetInvalidNameRule() *AwsAppstreamFleetInvalidNameRule { + return &AwsAppstreamFleetInvalidNameRule{ + resourceType: "aws_appstream_fleet", + attributeName: "name", + pattern: regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,100}$`), + } +} + +// Name returns the rule name +func (r *AwsAppstreamFleetInvalidNameRule) Name() string { + return "aws_appstream_fleet_invalid_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamFleetInvalidNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamFleetInvalidNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamFleetInvalidNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamFleetInvalidNameRule) 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 !r.pattern.MatchString(val) { + runner.EmitIssueOnExpr( + r, + fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,100}$`), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_fleet_invalid_stream_view.go b/rules/models/aws_appstream_fleet_invalid_stream_view.go new file mode 100644 index 00000000..5ae4252b --- /dev/null +++ b/rules/models/aws_appstream_fleet_invalid_stream_view.go @@ -0,0 +1,77 @@ +// 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" +) + +// AwsAppstreamFleetInvalidStreamViewRule checks the pattern is valid +type AwsAppstreamFleetInvalidStreamViewRule struct { + resourceType string + attributeName string + enum []string +} + +// NewAwsAppstreamFleetInvalidStreamViewRule returns new rule with default attributes +func NewAwsAppstreamFleetInvalidStreamViewRule() *AwsAppstreamFleetInvalidStreamViewRule { + return &AwsAppstreamFleetInvalidStreamViewRule{ + resourceType: "aws_appstream_fleet", + attributeName: "stream_view", + enum: []string{ + "APP", + "DESKTOP", + }, + } +} + +// Name returns the rule name +func (r *AwsAppstreamFleetInvalidStreamViewRule) Name() string { + return "aws_appstream_fleet_invalid_stream_view" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamFleetInvalidStreamViewRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamFleetInvalidStreamViewRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamFleetInvalidStreamViewRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamFleetInvalidStreamViewRule) 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 stream_view`, truncateLongMessage(val)), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_image_builder_invalid_appstream_agent_version.go b/rules/models/aws_appstream_image_builder_invalid_appstream_agent_version.go new file mode 100644 index 00000000..70e14ee1 --- /dev/null +++ b/rules/models/aws_appstream_image_builder_invalid_appstream_agent_version.go @@ -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" +) + +// AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule checks the pattern is valid +type AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule struct { + resourceType string + attributeName string + max int + min int +} + +// NewAwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule returns new rule with default attributes +func NewAwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule() *AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule { + return &AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule{ + resourceType: "aws_appstream_image_builder", + attributeName: "appstream_agent_version", + max: 100, + min: 1, + } +} + +// Name returns the rule name +func (r *AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule) Name() string { + return "aws_appstream_image_builder_invalid_appstream_agent_version" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule) 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, + "appstream_agent_version must be 100 characters or less", + attribute.Expr, + ) + } + if len(val) < r.min { + runner.EmitIssueOnExpr( + r, + "appstream_agent_version must be 1 characters or higher", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_image_builder_invalid_description.go b/rules/models/aws_appstream_image_builder_invalid_description.go new file mode 100644 index 00000000..e72044c3 --- /dev/null +++ b/rules/models/aws_appstream_image_builder_invalid_description.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamImageBuilderInvalidDescriptionRule checks the pattern is valid +type AwsAppstreamImageBuilderInvalidDescriptionRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamImageBuilderInvalidDescriptionRule returns new rule with default attributes +func NewAwsAppstreamImageBuilderInvalidDescriptionRule() *AwsAppstreamImageBuilderInvalidDescriptionRule { + return &AwsAppstreamImageBuilderInvalidDescriptionRule{ + resourceType: "aws_appstream_image_builder", + attributeName: "description", + max: 256, + } +} + +// Name returns the rule name +func (r *AwsAppstreamImageBuilderInvalidDescriptionRule) Name() string { + return "aws_appstream_image_builder_invalid_description" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamImageBuilderInvalidDescriptionRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamImageBuilderInvalidDescriptionRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamImageBuilderInvalidDescriptionRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamImageBuilderInvalidDescriptionRule) 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 256 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_image_builder_invalid_display_name.go b/rules/models/aws_appstream_image_builder_invalid_display_name.go new file mode 100644 index 00000000..aaa7d549 --- /dev/null +++ b/rules/models/aws_appstream_image_builder_invalid_display_name.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamImageBuilderInvalidDisplayNameRule checks the pattern is valid +type AwsAppstreamImageBuilderInvalidDisplayNameRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamImageBuilderInvalidDisplayNameRule returns new rule with default attributes +func NewAwsAppstreamImageBuilderInvalidDisplayNameRule() *AwsAppstreamImageBuilderInvalidDisplayNameRule { + return &AwsAppstreamImageBuilderInvalidDisplayNameRule{ + resourceType: "aws_appstream_image_builder", + attributeName: "display_name", + max: 100, + } +} + +// Name returns the rule name +func (r *AwsAppstreamImageBuilderInvalidDisplayNameRule) Name() string { + return "aws_appstream_image_builder_invalid_display_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamImageBuilderInvalidDisplayNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamImageBuilderInvalidDisplayNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamImageBuilderInvalidDisplayNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamImageBuilderInvalidDisplayNameRule) 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, + "display_name must be 100 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_image_builder_invalid_name.go b/rules/models/aws_appstream_image_builder_invalid_name.go new file mode 100644 index 00000000..1e6a9c78 --- /dev/null +++ b/rules/models/aws_appstream_image_builder_invalid_name.go @@ -0,0 +1,69 @@ +// 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" +) + +// AwsAppstreamImageBuilderInvalidNameRule checks the pattern is valid +type AwsAppstreamImageBuilderInvalidNameRule struct { + resourceType string + attributeName string + pattern *regexp.Regexp +} + +// NewAwsAppstreamImageBuilderInvalidNameRule returns new rule with default attributes +func NewAwsAppstreamImageBuilderInvalidNameRule() *AwsAppstreamImageBuilderInvalidNameRule { + return &AwsAppstreamImageBuilderInvalidNameRule{ + resourceType: "aws_appstream_image_builder", + attributeName: "name", + pattern: regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,100}$`), + } +} + +// Name returns the rule name +func (r *AwsAppstreamImageBuilderInvalidNameRule) Name() string { + return "aws_appstream_image_builder_invalid_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamImageBuilderInvalidNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamImageBuilderInvalidNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamImageBuilderInvalidNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamImageBuilderInvalidNameRule) 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 !r.pattern.MatchString(val) { + runner.EmitIssueOnExpr( + r, + fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,100}$`), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_stack_invalid_description.go b/rules/models/aws_appstream_stack_invalid_description.go new file mode 100644 index 00000000..b6300053 --- /dev/null +++ b/rules/models/aws_appstream_stack_invalid_description.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamStackInvalidDescriptionRule checks the pattern is valid +type AwsAppstreamStackInvalidDescriptionRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamStackInvalidDescriptionRule returns new rule with default attributes +func NewAwsAppstreamStackInvalidDescriptionRule() *AwsAppstreamStackInvalidDescriptionRule { + return &AwsAppstreamStackInvalidDescriptionRule{ + resourceType: "aws_appstream_stack", + attributeName: "description", + max: 256, + } +} + +// Name returns the rule name +func (r *AwsAppstreamStackInvalidDescriptionRule) Name() string { + return "aws_appstream_stack_invalid_description" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamStackInvalidDescriptionRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamStackInvalidDescriptionRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamStackInvalidDescriptionRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamStackInvalidDescriptionRule) 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 256 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_stack_invalid_display_name.go b/rules/models/aws_appstream_stack_invalid_display_name.go new file mode 100644 index 00000000..a6425036 --- /dev/null +++ b/rules/models/aws_appstream_stack_invalid_display_name.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamStackInvalidDisplayNameRule checks the pattern is valid +type AwsAppstreamStackInvalidDisplayNameRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamStackInvalidDisplayNameRule returns new rule with default attributes +func NewAwsAppstreamStackInvalidDisplayNameRule() *AwsAppstreamStackInvalidDisplayNameRule { + return &AwsAppstreamStackInvalidDisplayNameRule{ + resourceType: "aws_appstream_stack", + attributeName: "display_name", + max: 100, + } +} + +// Name returns the rule name +func (r *AwsAppstreamStackInvalidDisplayNameRule) Name() string { + return "aws_appstream_stack_invalid_display_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamStackInvalidDisplayNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamStackInvalidDisplayNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamStackInvalidDisplayNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamStackInvalidDisplayNameRule) 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, + "display_name must be 100 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_stack_invalid_feedback_url.go b/rules/models/aws_appstream_stack_invalid_feedback_url.go new file mode 100644 index 00000000..ef342695 --- /dev/null +++ b/rules/models/aws_appstream_stack_invalid_feedback_url.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamStackInvalidFeedbackURLRule checks the pattern is valid +type AwsAppstreamStackInvalidFeedbackURLRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamStackInvalidFeedbackURLRule returns new rule with default attributes +func NewAwsAppstreamStackInvalidFeedbackURLRule() *AwsAppstreamStackInvalidFeedbackURLRule { + return &AwsAppstreamStackInvalidFeedbackURLRule{ + resourceType: "aws_appstream_stack", + attributeName: "feedback_url", + max: 1000, + } +} + +// Name returns the rule name +func (r *AwsAppstreamStackInvalidFeedbackURLRule) Name() string { + return "aws_appstream_stack_invalid_feedback_url" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamStackInvalidFeedbackURLRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamStackInvalidFeedbackURLRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamStackInvalidFeedbackURLRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamStackInvalidFeedbackURLRule) 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, + "feedback_url must be 1000 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_stack_invalid_redirect_url.go b/rules/models/aws_appstream_stack_invalid_redirect_url.go new file mode 100644 index 00000000..8f128b08 --- /dev/null +++ b/rules/models/aws_appstream_stack_invalid_redirect_url.go @@ -0,0 +1,67 @@ +// 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" +) + +// AwsAppstreamStackInvalidRedirectURLRule checks the pattern is valid +type AwsAppstreamStackInvalidRedirectURLRule struct { + resourceType string + attributeName string + max int +} + +// NewAwsAppstreamStackInvalidRedirectURLRule returns new rule with default attributes +func NewAwsAppstreamStackInvalidRedirectURLRule() *AwsAppstreamStackInvalidRedirectURLRule { + return &AwsAppstreamStackInvalidRedirectURLRule{ + resourceType: "aws_appstream_stack", + attributeName: "redirect_url", + max: 1000, + } +} + +// Name returns the rule name +func (r *AwsAppstreamStackInvalidRedirectURLRule) Name() string { + return "aws_appstream_stack_invalid_redirect_url" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamStackInvalidRedirectURLRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamStackInvalidRedirectURLRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamStackInvalidRedirectURLRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamStackInvalidRedirectURLRule) 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, + "redirect_url must be 1000 characters or less", + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_user_invalid_authentication_type.go b/rules/models/aws_appstream_user_invalid_authentication_type.go new file mode 100644 index 00000000..6e6681a3 --- /dev/null +++ b/rules/models/aws_appstream_user_invalid_authentication_type.go @@ -0,0 +1,78 @@ +// 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" +) + +// AwsAppstreamUserInvalidAuthenticationTypeRule checks the pattern is valid +type AwsAppstreamUserInvalidAuthenticationTypeRule struct { + resourceType string + attributeName string + enum []string +} + +// NewAwsAppstreamUserInvalidAuthenticationTypeRule returns new rule with default attributes +func NewAwsAppstreamUserInvalidAuthenticationTypeRule() *AwsAppstreamUserInvalidAuthenticationTypeRule { + return &AwsAppstreamUserInvalidAuthenticationTypeRule{ + resourceType: "aws_appstream_user", + attributeName: "authentication_type", + enum: []string{ + "API", + "SAML", + "USERPOOL", + }, + } +} + +// Name returns the rule name +func (r *AwsAppstreamUserInvalidAuthenticationTypeRule) Name() string { + return "aws_appstream_user_invalid_authentication_type" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamUserInvalidAuthenticationTypeRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamUserInvalidAuthenticationTypeRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamUserInvalidAuthenticationTypeRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamUserInvalidAuthenticationTypeRule) 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 authentication_type`, truncateLongMessage(val)), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_user_invalid_first_name.go b/rules/models/aws_appstream_user_invalid_first_name.go new file mode 100644 index 00000000..4407066c --- /dev/null +++ b/rules/models/aws_appstream_user_invalid_first_name.go @@ -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" +) + +// AwsAppstreamUserInvalidFirstNameRule checks the pattern is valid +type AwsAppstreamUserInvalidFirstNameRule struct { + resourceType string + attributeName string + max int + pattern *regexp.Regexp +} + +// NewAwsAppstreamUserInvalidFirstNameRule returns new rule with default attributes +func NewAwsAppstreamUserInvalidFirstNameRule() *AwsAppstreamUserInvalidFirstNameRule { + return &AwsAppstreamUserInvalidFirstNameRule{ + resourceType: "aws_appstream_user", + attributeName: "first_name", + max: 2048, + pattern: regexp.MustCompile(`^[A-Za-z0-9_\-\s]+$`), + } +} + +// Name returns the rule name +func (r *AwsAppstreamUserInvalidFirstNameRule) Name() string { + return "aws_appstream_user_invalid_first_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamUserInvalidFirstNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamUserInvalidFirstNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamUserInvalidFirstNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamUserInvalidFirstNameRule) 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, + "first_name must be 2048 characters or less", + 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_\-\s]+$`), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_user_invalid_last_name.go b/rules/models/aws_appstream_user_invalid_last_name.go new file mode 100644 index 00000000..d0868816 --- /dev/null +++ b/rules/models/aws_appstream_user_invalid_last_name.go @@ -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" +) + +// AwsAppstreamUserInvalidLastNameRule checks the pattern is valid +type AwsAppstreamUserInvalidLastNameRule struct { + resourceType string + attributeName string + max int + pattern *regexp.Regexp +} + +// NewAwsAppstreamUserInvalidLastNameRule returns new rule with default attributes +func NewAwsAppstreamUserInvalidLastNameRule() *AwsAppstreamUserInvalidLastNameRule { + return &AwsAppstreamUserInvalidLastNameRule{ + resourceType: "aws_appstream_user", + attributeName: "last_name", + max: 2048, + pattern: regexp.MustCompile(`^[A-Za-z0-9_\-\s]+$`), + } +} + +// Name returns the rule name +func (r *AwsAppstreamUserInvalidLastNameRule) Name() string { + return "aws_appstream_user_invalid_last_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamUserInvalidLastNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamUserInvalidLastNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamUserInvalidLastNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamUserInvalidLastNameRule) 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, + "last_name must be 2048 characters or less", + 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_\-\s]+$`), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_user_invalid_user_name.go b/rules/models/aws_appstream_user_invalid_user_name.go new file mode 100644 index 00000000..03a57e7e --- /dev/null +++ b/rules/models/aws_appstream_user_invalid_user_name.go @@ -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" +) + +// AwsAppstreamUserInvalidUserNameRule checks the pattern is valid +type AwsAppstreamUserInvalidUserNameRule struct { + resourceType string + attributeName string + max int + min int + pattern *regexp.Regexp +} + +// NewAwsAppstreamUserInvalidUserNameRule returns new rule with default attributes +func NewAwsAppstreamUserInvalidUserNameRule() *AwsAppstreamUserInvalidUserNameRule { + return &AwsAppstreamUserInvalidUserNameRule{ + resourceType: "aws_appstream_user", + attributeName: "user_name", + max: 128, + min: 1, + pattern: regexp.MustCompile(`^[\p{L}\p{M}\p{S}\p{N}\p{P}]+$`), + } +} + +// Name returns the rule name +func (r *AwsAppstreamUserInvalidUserNameRule) Name() string { + return "aws_appstream_user_invalid_user_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamUserInvalidUserNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamUserInvalidUserNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamUserInvalidUserNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamUserInvalidUserNameRule) 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, + "user_name must be 128 characters or less", + attribute.Expr, + ) + } + if len(val) < r.min { + runner.EmitIssueOnExpr( + r, + "user_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), `^[\p{L}\p{M}\p{S}\p{N}\p{P}]+$`), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_user_stack_association_invalid_authentication_type.go b/rules/models/aws_appstream_user_stack_association_invalid_authentication_type.go new file mode 100644 index 00000000..d7f111e3 --- /dev/null +++ b/rules/models/aws_appstream_user_stack_association_invalid_authentication_type.go @@ -0,0 +1,78 @@ +// 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" +) + +// AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule checks the pattern is valid +type AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule struct { + resourceType string + attributeName string + enum []string +} + +// NewAwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule returns new rule with default attributes +func NewAwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule() *AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule { + return &AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule{ + resourceType: "aws_appstream_user_stack_association", + attributeName: "authentication_type", + enum: []string{ + "API", + "SAML", + "USERPOOL", + }, + } +} + +// Name returns the rule name +func (r *AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule) Name() string { + return "aws_appstream_user_stack_association_invalid_authentication_type" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule) 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 authentication_type`, truncateLongMessage(val)), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/aws_appstream_user_stack_association_invalid_user_name.go b/rules/models/aws_appstream_user_stack_association_invalid_user_name.go new file mode 100644 index 00000000..cf567f36 --- /dev/null +++ b/rules/models/aws_appstream_user_stack_association_invalid_user_name.go @@ -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" +) + +// AwsAppstreamUserStackAssociationInvalidUserNameRule checks the pattern is valid +type AwsAppstreamUserStackAssociationInvalidUserNameRule struct { + resourceType string + attributeName string + max int + min int + pattern *regexp.Regexp +} + +// NewAwsAppstreamUserStackAssociationInvalidUserNameRule returns new rule with default attributes +func NewAwsAppstreamUserStackAssociationInvalidUserNameRule() *AwsAppstreamUserStackAssociationInvalidUserNameRule { + return &AwsAppstreamUserStackAssociationInvalidUserNameRule{ + resourceType: "aws_appstream_user_stack_association", + attributeName: "user_name", + max: 128, + min: 1, + pattern: regexp.MustCompile(`^[\p{L}\p{M}\p{S}\p{N}\p{P}]+$`), + } +} + +// Name returns the rule name +func (r *AwsAppstreamUserStackAssociationInvalidUserNameRule) Name() string { + return "aws_appstream_user_stack_association_invalid_user_name" +} + +// Enabled returns whether the rule is enabled by default +func (r *AwsAppstreamUserStackAssociationInvalidUserNameRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *AwsAppstreamUserStackAssociationInvalidUserNameRule) Severity() string { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *AwsAppstreamUserStackAssociationInvalidUserNameRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *AwsAppstreamUserStackAssociationInvalidUserNameRule) 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, + "user_name must be 128 characters or less", + attribute.Expr, + ) + } + if len(val) < r.min { + runner.EmitIssueOnExpr( + r, + "user_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), `^[\p{L}\p{M}\p{S}\p{N}\p{P}]+$`), + attribute.Expr, + ) + } + return nil + }) + }) +} diff --git a/rules/models/mappings/appstream.hcl b/rules/models/mappings/appstream.hcl new file mode 100644 index 00000000..0a0edd6a --- /dev/null +++ b/rules/models/mappings/appstream.hcl @@ -0,0 +1,57 @@ +import = "aws-sdk-go/models/apis/appstream/2016-12-01/api-2.json" + +mapping "aws_appstream_directory_config" { + directory_name = DirectoryName + organizational_unit_distinguished_names = OrganizationalUnitDistinguishedNamesList + service_account_credentials = ServiceAccountCredentials +} + +mapping "aws_appstream_fleet" { + compute_capacity = ComputeCapacity + name = Name + description = Description + display_name = DisplayName + domain_join_info = DomainJoinInfo + fleet_type = FleetType + # iam_role_arn = Arn # https://github.com/golang/go/issues/7252 + # image_arn = Arn # https://github.com/golang/go/issues/7252 + stream_view = StreamView + vpc_config = VpcConfig + tags = Tags +} + +mapping "aws_appstream_image_builder" { + name = Name + access_endpoint = AccessEndpointList + appstream_agent_version = AppstreamAgentVersion + description = Description + display_name = DisplayName + domain_join_info = DomainJoinInfo + # iam_role_arn = Arn # https://github.com/golang/go/issues/7252 + # image_arn = Arn # https://github.com/golang/go/issues/7252 + vpc_config = VpcConfig + tags = Tags +} + +mapping "aws_appstream_stack" { + application_settings = ApplicationSettings + description = Description + display_name = DisplayName + embed_host_domains = EmbedHostDomains + feedback_url = FeedbackURL + redirect_url = RedirectURL + storage_connectors = StorageConnectorList + user_settings = UserSettingList +} + +mapping "aws_appstream_user" { + authentication_type = AuthenticationType + user_name = Username + first_name = UserAttributeValue + last_name = UserAttributeValue +} + +mapping "aws_appstream_user_stack_association" { + authentication_type = AuthenticationType + user_name = Username +} diff --git a/rules/models/provider.go b/rules/models/provider.go index 3484f577..8c609dec 100644 --- a/rules/models/provider.go +++ b/rules/models/provider.go @@ -129,6 +129,25 @@ var Rules = []tflint.Rule{ NewAwsApprunnerConnectionInvalidProviderTypeRule(), NewAwsApprunnerCustomDomainAssociationInvalidDomainNameRule(), NewAwsApprunnerServiceInvalidServiceNameRule(), + NewAwsAppstreamFleetInvalidDescriptionRule(), + NewAwsAppstreamFleetInvalidDisplayNameRule(), + NewAwsAppstreamFleetInvalidFleetTypeRule(), + NewAwsAppstreamFleetInvalidNameRule(), + NewAwsAppstreamFleetInvalidStreamViewRule(), + NewAwsAppstreamImageBuilderInvalidAppstreamAgentVersionRule(), + NewAwsAppstreamImageBuilderInvalidDescriptionRule(), + NewAwsAppstreamImageBuilderInvalidDisplayNameRule(), + NewAwsAppstreamImageBuilderInvalidNameRule(), + NewAwsAppstreamStackInvalidDescriptionRule(), + NewAwsAppstreamStackInvalidDisplayNameRule(), + NewAwsAppstreamStackInvalidFeedbackURLRule(), + NewAwsAppstreamStackInvalidRedirectURLRule(), + NewAwsAppstreamUserInvalidAuthenticationTypeRule(), + NewAwsAppstreamUserInvalidFirstNameRule(), + NewAwsAppstreamUserInvalidLastNameRule(), + NewAwsAppstreamUserInvalidUserNameRule(), + NewAwsAppstreamUserStackAssociationInvalidAuthenticationTypeRule(), + NewAwsAppstreamUserStackAssociationInvalidUserNameRule(), NewAwsAppsyncDatasourceInvalidNameRule(), NewAwsAppsyncDatasourceInvalidTypeRule(), NewAwsAppsyncFunctionInvalidDataSourceRule(),