Skip to content

Commit

Permalink
Update AWS provider/module and generated content (#650)
Browse files Browse the repository at this point in the history
Co-authored-by: bendrucker <808808+bendrucker@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and bendrucker authored Jun 17, 2024
1 parent 300933d commit 724e354
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 24 deletions.
50 changes: 50 additions & 0 deletions aws/mock/ec2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.4

require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/aws/aws-sdk-go v1.53.19
github.com/aws/aws-sdk-go v1.54.2
github.com/dave/dst v0.27.3
github.com/fatih/color v1.13.0 // indirect
github.com/golang/mock v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
github.com/aws/aws-sdk-go v1.31.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0=
github.com/aws/aws-sdk-go v1.53.19 h1:WEuWc918RXlIaPCyU11F7hH9H1ItK+8m2c/uoQNRUok=
github.com/aws/aws-sdk-go v1.53.19/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go v1.54.2 h1:Wo6AVWcleNHrYa48YzfYz60hzxGRqsJrK5s/qePe+3I=
github.com/aws/aws-sdk-go v1.54.2/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
github.com/dave/dst v0.27.3 h1:P1HPoMza3cMEquVf9kKy8yXsFirry4zEnWOdYPOoIzY=
Expand Down
2 changes: 1 addition & 1 deletion rules/models/aws-sdk-go
Submodule aws-sdk-go updated 144 files
13 changes: 11 additions & 2 deletions rules/models/aws_cloudhsm_v2_cluster_invalid_hsm_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type AwsCloudhsmV2ClusterInvalidHsmTypeRule struct {

resourceType string
attributeName string
max int
pattern *regexp.Regexp
}

Expand All @@ -25,7 +26,8 @@ func NewAwsCloudhsmV2ClusterInvalidHsmTypeRule() *AwsCloudhsmV2ClusterInvalidHsm
return &AwsCloudhsmV2ClusterInvalidHsmTypeRule{
resourceType: "aws_cloudhsm_v2_cluster",
attributeName: "hsm_type",
pattern: regexp.MustCompile(`^(hsm1\.medium)$`),
max: 32,
pattern: regexp.MustCompile(`^((p|)hsm[0-9][a-z.]*\.[a-zA-Z]+)$`),
}
}

Expand Down Expand Up @@ -69,10 +71,17 @@ func (r *AwsCloudhsmV2ClusterInvalidHsmTypeRule) Check(runner tflint.Runner) err
}

err := runner.EvaluateExpr(attribute.Expr, func (val string) error {
if len(val) > r.max {
runner.EmitIssue(
r,
"hsm_type must be 32 characters or less",
attribute.Expr.Range(),
)
}
if !r.pattern.MatchString(val) {
runner.EmitIssue(
r,
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^(hsm1\.medium)$`),
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^((p|)hsm[0-9][a-z.]*\.[a-zA-Z]+)$`),
attribute.Expr.Range(),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "aws_cloudhsm_v2_cluster" "foo" {
Expected: helper.Issues{
{
Rule: NewAwsCloudhsmV2ClusterInvalidHsmTypeRule(),
Message: fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage("hsm1.micro"), `^(hsm1\.medium)$`),
Message: fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage("hsm1.micro"), `^((p|)hsm[0-9][a-z.]*\.[a-zA-Z]+)$`),
},
},
},
Expand Down
1 change: 1 addition & 0 deletions rules/models/aws_kms_key_invalid_key_usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func NewAwsKmsKeyInvalidKeyUsageRule() *AwsKmsKeyInvalidKeyUsageRule {
"SIGN_VERIFY",
"ENCRYPT_DECRYPT",
"GENERATE_VERIFY_MAC",
"KEY_AGREEMENT",
},
}
}
Expand Down
5 changes: 5 additions & 0 deletions rules/tags/resources.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions tools/provider-schema/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/provider-schema/schema.json

Large diffs are not rendered by default.

0 comments on commit 724e354

Please sign in to comment.