Skip to content

Commit a0abb83

Browse files
authored
fix: update mappings for AWS Provider v6 compatibility (#902)
1 parent 9b8760e commit a0abb83

23 files changed

+836
-415
lines changed

docs/rules/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,14 @@ These rules enforce best practices and naming conventions:
517517
|aws_dms_endpoint_invalid_endpoint_type||
518518
|aws_dms_endpoint_invalid_ssl_mode||
519519
|aws_dms_replication_task_invalid_migration_type||
520+
|aws_dms_s3_endpoint_invalid_canned_acl_for_objects||
521+
|aws_dms_s3_endpoint_invalid_compression_type||
522+
|aws_dms_s3_endpoint_invalid_data_format||
523+
|aws_dms_s3_endpoint_invalid_date_partition_delimiter||
524+
|aws_dms_s3_endpoint_invalid_date_partition_sequence||
525+
|aws_dms_s3_endpoint_invalid_encoding_type||
526+
|aws_dms_s3_endpoint_invalid_encryption_mode||
527+
|aws_dms_s3_endpoint_invalid_parquet_version||
520528
|aws_docdb_global_cluster_invalid_global_cluster_identifier||
521529
|aws_dx_bgp_peer_invalid_address_family||
522530
|aws_dx_hosted_private_virtual_interface_invalid_address_family||
@@ -586,7 +594,6 @@ These rules enforce best practices and naming conventions:
586594
|aws_efs_mount_target_invalid_ip_address||
587595
|aws_efs_mount_target_invalid_subnet_id||
588596
|aws_eks_addon_invalid_cluster_name||
589-
|aws_eks_addon_invalid_resolve_conflicts||
590597
|aws_eks_addon_invalid_service_account_role_arn||
591598
|aws_eks_cluster_invalid_name||
592599
|aws_eks_node_group_invalid_ami_type||
@@ -930,11 +937,6 @@ These rules enforce best practices and naming conventions:
930937
|aws_networkfirewall_rule_group_invalid_name||
931938
|aws_networkfirewall_rule_group_invalid_rules||
932939
|aws_networkfirewall_rule_group_invalid_type||
933-
|aws_opsworks_application_invalid_type||
934-
|aws_opsworks_instance_invalid_architecture||
935-
|aws_opsworks_instance_invalid_auto_scaling_type||
936-
|aws_opsworks_instance_invalid_root_device_type||
937-
|aws_opsworks_stack_invalid_default_root_device_type||
938940
|aws_organizations_account_invalid_email||
939941
|aws_organizations_account_invalid_iam_user_access_to_billing||
940942
|aws_organizations_account_invalid_name||
@@ -1260,7 +1262,6 @@ These rules enforce best practices and naming conventions:
12601262
|aws_ssm_association_invalid_association_name||
12611263
|aws_ssm_association_invalid_compliance_severity||
12621264
|aws_ssm_association_invalid_document_version||
1263-
|aws_ssm_association_invalid_instance_id||
12641265
|aws_ssm_association_invalid_max_concurrency||
12651266
|aws_ssm_association_invalid_max_errors||
12661267
|aws_ssm_association_invalid_name||
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"fmt"
7+
8+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
9+
"github.com/terraform-linters/tflint-plugin-sdk/logger"
10+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
11+
)
12+
13+
// AwsDmsS3EndpointInvalidCannedACLForObjectsRule checks the pattern is valid
14+
type AwsDmsS3EndpointInvalidCannedACLForObjectsRule struct {
15+
tflint.DefaultRule
16+
17+
resourceType string
18+
attributeName string
19+
enum []string
20+
}
21+
22+
// NewAwsDmsS3EndpointInvalidCannedACLForObjectsRule returns new rule with default attributes
23+
func NewAwsDmsS3EndpointInvalidCannedACLForObjectsRule() *AwsDmsS3EndpointInvalidCannedACLForObjectsRule {
24+
return &AwsDmsS3EndpointInvalidCannedACLForObjectsRule{
25+
resourceType: "aws_dms_s3_endpoint",
26+
attributeName: "canned_acl_for_objects",
27+
enum: []string{
28+
"none",
29+
"private",
30+
"public-read",
31+
"public-read-write",
32+
"authenticated-read",
33+
"aws-exec-read",
34+
"bucket-owner-read",
35+
"bucket-owner-full-control",
36+
},
37+
}
38+
}
39+
40+
// Name returns the rule name
41+
func (r *AwsDmsS3EndpointInvalidCannedACLForObjectsRule) Name() string {
42+
return "aws_dms_s3_endpoint_invalid_canned_acl_for_objects"
43+
}
44+
45+
// Enabled returns whether the rule is enabled by default
46+
func (r *AwsDmsS3EndpointInvalidCannedACLForObjectsRule) Enabled() bool {
47+
return true
48+
}
49+
50+
// Severity returns the rule severity
51+
func (r *AwsDmsS3EndpointInvalidCannedACLForObjectsRule) Severity() tflint.Severity {
52+
return tflint.ERROR
53+
}
54+
55+
// Link returns the rule reference link
56+
func (r *AwsDmsS3EndpointInvalidCannedACLForObjectsRule) Link() string {
57+
return ""
58+
}
59+
60+
// Check checks the pattern is valid
61+
func (r *AwsDmsS3EndpointInvalidCannedACLForObjectsRule) Check(runner tflint.Runner) error {
62+
logger.Trace("Check `%s` rule", r.Name())
63+
64+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
65+
Attributes: []hclext.AttributeSchema{
66+
{Name: r.attributeName},
67+
},
68+
}, nil)
69+
if err != nil {
70+
return err
71+
}
72+
73+
for _, resource := range resources.Blocks {
74+
attribute, exists := resource.Body.Attributes[r.attributeName]
75+
if !exists {
76+
continue
77+
}
78+
79+
err := runner.EvaluateExpr(attribute.Expr, func (val string) error {
80+
found := false
81+
for _, item := range r.enum {
82+
if item == val {
83+
found = true
84+
}
85+
}
86+
if !found {
87+
runner.EmitIssue(
88+
r,
89+
fmt.Sprintf(`"%s" is an invalid value as canned_acl_for_objects`, truncateLongMessage(val)),
90+
attribute.Expr.Range(),
91+
)
92+
}
93+
return nil
94+
}, nil)
95+
if err != nil {
96+
return err
97+
}
98+
}
99+
100+
return nil
101+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"fmt"
7+
8+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
9+
"github.com/terraform-linters/tflint-plugin-sdk/logger"
10+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
11+
)
12+
13+
// AwsDmsS3EndpointInvalidCompressionTypeRule checks the pattern is valid
14+
type AwsDmsS3EndpointInvalidCompressionTypeRule struct {
15+
tflint.DefaultRule
16+
17+
resourceType string
18+
attributeName string
19+
enum []string
20+
}
21+
22+
// NewAwsDmsS3EndpointInvalidCompressionTypeRule returns new rule with default attributes
23+
func NewAwsDmsS3EndpointInvalidCompressionTypeRule() *AwsDmsS3EndpointInvalidCompressionTypeRule {
24+
return &AwsDmsS3EndpointInvalidCompressionTypeRule{
25+
resourceType: "aws_dms_s3_endpoint",
26+
attributeName: "compression_type",
27+
enum: []string{
28+
"none",
29+
"gzip",
30+
},
31+
}
32+
}
33+
34+
// Name returns the rule name
35+
func (r *AwsDmsS3EndpointInvalidCompressionTypeRule) Name() string {
36+
return "aws_dms_s3_endpoint_invalid_compression_type"
37+
}
38+
39+
// Enabled returns whether the rule is enabled by default
40+
func (r *AwsDmsS3EndpointInvalidCompressionTypeRule) Enabled() bool {
41+
return true
42+
}
43+
44+
// Severity returns the rule severity
45+
func (r *AwsDmsS3EndpointInvalidCompressionTypeRule) Severity() tflint.Severity {
46+
return tflint.ERROR
47+
}
48+
49+
// Link returns the rule reference link
50+
func (r *AwsDmsS3EndpointInvalidCompressionTypeRule) Link() string {
51+
return ""
52+
}
53+
54+
// Check checks the pattern is valid
55+
func (r *AwsDmsS3EndpointInvalidCompressionTypeRule) Check(runner tflint.Runner) error {
56+
logger.Trace("Check `%s` rule", r.Name())
57+
58+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
59+
Attributes: []hclext.AttributeSchema{
60+
{Name: r.attributeName},
61+
},
62+
}, nil)
63+
if err != nil {
64+
return err
65+
}
66+
67+
for _, resource := range resources.Blocks {
68+
attribute, exists := resource.Body.Attributes[r.attributeName]
69+
if !exists {
70+
continue
71+
}
72+
73+
err := runner.EvaluateExpr(attribute.Expr, func (val string) error {
74+
found := false
75+
for _, item := range r.enum {
76+
if item == val {
77+
found = true
78+
}
79+
}
80+
if !found {
81+
runner.EmitIssue(
82+
r,
83+
fmt.Sprintf(`"%s" is an invalid value as compression_type`, truncateLongMessage(val)),
84+
attribute.Expr.Range(),
85+
)
86+
}
87+
return nil
88+
}, nil)
89+
if err != nil {
90+
return err
91+
}
92+
}
93+
94+
return nil
95+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// This file generated by `generator/`. DO NOT EDIT
2+
3+
package models
4+
5+
import (
6+
"fmt"
7+
8+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
9+
"github.com/terraform-linters/tflint-plugin-sdk/logger"
10+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
11+
)
12+
13+
// AwsDmsS3EndpointInvalidDataFormatRule checks the pattern is valid
14+
type AwsDmsS3EndpointInvalidDataFormatRule struct {
15+
tflint.DefaultRule
16+
17+
resourceType string
18+
attributeName string
19+
enum []string
20+
}
21+
22+
// NewAwsDmsS3EndpointInvalidDataFormatRule returns new rule with default attributes
23+
func NewAwsDmsS3EndpointInvalidDataFormatRule() *AwsDmsS3EndpointInvalidDataFormatRule {
24+
return &AwsDmsS3EndpointInvalidDataFormatRule{
25+
resourceType: "aws_dms_s3_endpoint",
26+
attributeName: "data_format",
27+
enum: []string{
28+
"csv",
29+
"parquet",
30+
},
31+
}
32+
}
33+
34+
// Name returns the rule name
35+
func (r *AwsDmsS3EndpointInvalidDataFormatRule) Name() string {
36+
return "aws_dms_s3_endpoint_invalid_data_format"
37+
}
38+
39+
// Enabled returns whether the rule is enabled by default
40+
func (r *AwsDmsS3EndpointInvalidDataFormatRule) Enabled() bool {
41+
return true
42+
}
43+
44+
// Severity returns the rule severity
45+
func (r *AwsDmsS3EndpointInvalidDataFormatRule) Severity() tflint.Severity {
46+
return tflint.ERROR
47+
}
48+
49+
// Link returns the rule reference link
50+
func (r *AwsDmsS3EndpointInvalidDataFormatRule) Link() string {
51+
return ""
52+
}
53+
54+
// Check checks the pattern is valid
55+
func (r *AwsDmsS3EndpointInvalidDataFormatRule) Check(runner tflint.Runner) error {
56+
logger.Trace("Check `%s` rule", r.Name())
57+
58+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
59+
Attributes: []hclext.AttributeSchema{
60+
{Name: r.attributeName},
61+
},
62+
}, nil)
63+
if err != nil {
64+
return err
65+
}
66+
67+
for _, resource := range resources.Blocks {
68+
attribute, exists := resource.Body.Attributes[r.attributeName]
69+
if !exists {
70+
continue
71+
}
72+
73+
err := runner.EvaluateExpr(attribute.Expr, func (val string) error {
74+
found := false
75+
for _, item := range r.enum {
76+
if item == val {
77+
found = true
78+
}
79+
}
80+
if !found {
81+
runner.EmitIssue(
82+
r,
83+
fmt.Sprintf(`"%s" is an invalid value as data_format`, truncateLongMessage(val)),
84+
attribute.Expr.Range(),
85+
)
86+
}
87+
return nil
88+
}, nil)
89+
if err != nil {
90+
return err
91+
}
92+
}
93+
94+
return nil
95+
}

0 commit comments

Comments
 (0)