Skip to content

Commit

Permalink
Remove redundant constructors for filters
Browse files Browse the repository at this point in the history
  • Loading branch information
minamijoyo committed Feb 13, 2022
1 parent fc11a0d commit eeeb419
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 2 additions & 2 deletions filter/awsv4upgrade/aws_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func NewAWSS3BucketFilter() editor.Filter {
// Filter upgrades arguments of aws_s3_bucket to AWS provider v4.
func (f *AWSS3BucketFilter) Filter(inFile *hclwrite.File) (*hclwrite.File, error) {
m := editor.NewMultiFilter([]editor.Filter{
NewAWSS3BucketACLFilter(),
NewAWSS3BucketLoggingFilter(),
&AWSS3BucketACLFilter{},
&AWSS3BucketLoggingFilter{},
})
return m.Filter(inFile)
}
Expand Down
8 changes: 1 addition & 7 deletions filter/awsv4upgrade/aws_s3_bucket_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@ import (
// AWSS3BucketACLFilter is a filter implementation for upgrading the acl
// argument of aws_s3_bucket.
// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade#acl-argument
type AWSS3BucketACLFilter struct {
}
type AWSS3BucketACLFilter struct{}

var _ editor.Filter = (*AWSS3BucketACLFilter)(nil)

// NewAWSS3BucketACLFilter creates a new instance of AWSS3BucketACLFilter.
func NewAWSS3BucketACLFilter() editor.Filter {
return &AWSS3BucketACLFilter{}
}

// Filter upgrades the acl argument of aws_s3_bucket.
func (f *AWSS3BucketACLFilter) Filter(inFile *hclwrite.File) (*hclwrite.File, error) {
blocks := findResourceByType(inFile.Body(), "aws_s3_bucket")
Expand Down
3 changes: 1 addition & 2 deletions filter/awsv4upgrade/aws_s3_bucket_logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import (
// AWSS3BucketLoggingFilter is a filter implementation for upgrading the
// logging argument of aws_s3_bucket.
// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/guides/version-4-upgrade#logging-argument
type AWSS3BucketLoggingFilter struct {
}
type AWSS3BucketLoggingFilter struct{}

var _ editor.Filter = (*AWSS3BucketLoggingFilter)(nil)

Expand Down

0 comments on commit eeeb419

Please sign in to comment.