generated from terraform-linters/tflint-ruleset-template
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autogenerate rules from Magic Modules
- Loading branch information
Showing
110 changed files
with
8,153 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tools/magic-modules"] | ||
path = tools/magic-modules | ||
url = [email protected]:terraform-linters/magic-modules.git |
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
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
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,11 @@ | ||
package project | ||
|
||
import "fmt" | ||
|
||
// Version is ruleset version | ||
const Version string = "0.1.0" | ||
|
||
// ReferenceLink returns the rule reference link | ||
func ReferenceLink(name string) string { | ||
return fmt.Sprintf("https://github.com/terraform-linters/tflint-ruleset-google/blob/v%s/docs/rules/%s.md", Version, name) | ||
} |
73 changes: 73 additions & 0 deletions
73
rules/magicmodules/google_access_context_manager_service_perimeter_invalid_perimeter_type.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,73 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// This file is automatically generated by Magic Modules and manual | ||
// changes will be clobbered when the file is regenerated. | ||
// | ||
// Please read more about how to change this file in | ||
// .github/CONTRIBUTING.md. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
package magicmodules | ||
|
||
import ( | ||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule checks the pattern is valid | ||
type GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule struct { | ||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule returns new rule with default attributes | ||
func NewGoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule() *GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule { | ||
return &GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule{ | ||
resourceType: "google_access_context_manager_service_perimeter", | ||
attributeName: "perimeter_type", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule) Name() string { | ||
return "google_access_context_manager_service_perimeter_invalid_perimeter_type" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule) Check(runner tflint.Runner) error { | ||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val) | ||
|
||
validateFunc := validation.StringInSlice([]string{"PERIMETER_TYPE_REGULAR", "PERIMETER_TYPE_BRIDGE", ""}, false) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
_, errors := validateFunc(val, r.attributeName) | ||
for _, err := range errors { | ||
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
73 changes: 73 additions & 0 deletions
73
rules/magicmodules/google_active_directory_domain_trust_invalid_trust_direction.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,73 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// This file is automatically generated by Magic Modules and manual | ||
// changes will be clobbered when the file is regenerated. | ||
// | ||
// Please read more about how to change this file in | ||
// .github/CONTRIBUTING.md. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
package magicmodules | ||
|
||
import ( | ||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule checks the pattern is valid | ||
type GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule struct { | ||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule returns new rule with default attributes | ||
func NewGoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule() *GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule { | ||
return &GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule{ | ||
resourceType: "google_active_directory_domain_trust", | ||
attributeName: "trust_direction", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule) Name() string { | ||
return "google_active_directory_domain_trust_invalid_trust_direction" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule) Check(runner tflint.Runner) error { | ||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val) | ||
|
||
validateFunc := validation.StringInSlice([]string{"INBOUND", "OUTBOUND", "BIDIRECTIONAL"}, false) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
_, errors := validateFunc(val, r.attributeName) | ||
for _, err := range errors { | ||
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
73 changes: 73 additions & 0 deletions
73
rules/magicmodules/google_active_directory_domain_trust_invalid_trust_type.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,73 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// This file is automatically generated by Magic Modules and manual | ||
// changes will be clobbered when the file is regenerated. | ||
// | ||
// Please read more about how to change this file in | ||
// .github/CONTRIBUTING.md. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
package magicmodules | ||
|
||
import ( | ||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule checks the pattern is valid | ||
type GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule struct { | ||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleActiveDirectoryDomainTrustInvalidTrustTypeRule returns new rule with default attributes | ||
func NewGoogleActiveDirectoryDomainTrustInvalidTrustTypeRule() *GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule { | ||
return &GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule{ | ||
resourceType: "google_active_directory_domain_trust", | ||
attributeName: "trust_type", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule) Name() string { | ||
return "google_active_directory_domain_trust_invalid_trust_type" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleActiveDirectoryDomainTrustInvalidTrustTypeRule) Check(runner tflint.Runner) error { | ||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val) | ||
|
||
validateFunc := validation.StringInSlice([]string{"FOREST", "EXTERNAL"}, false) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
_, errors := validateFunc(val, r.attributeName) | ||
for _, err := range errors { | ||
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
73 changes: 73 additions & 0 deletions
73
rules/magicmodules/google_app_engine_domain_mapping_invalid_override_strategy.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,73 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// This file is automatically generated by Magic Modules and manual | ||
// changes will be clobbered when the file is regenerated. | ||
// | ||
// Please read more about how to change this file in | ||
// .github/CONTRIBUTING.md. | ||
// | ||
// ---------------------------------------------------------------------------- | ||
|
||
package magicmodules | ||
|
||
import ( | ||
hcl "github.com/hashicorp/hcl/v2" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// GoogleAppEngineDomainMappingInvalidOverrideStrategyRule checks the pattern is valid | ||
type GoogleAppEngineDomainMappingInvalidOverrideStrategyRule struct { | ||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleAppEngineDomainMappingInvalidOverrideStrategyRule returns new rule with default attributes | ||
func NewGoogleAppEngineDomainMappingInvalidOverrideStrategyRule() *GoogleAppEngineDomainMappingInvalidOverrideStrategyRule { | ||
return &GoogleAppEngineDomainMappingInvalidOverrideStrategyRule{ | ||
resourceType: "google_app_engine_domain_mapping", | ||
attributeName: "override_strategy", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleAppEngineDomainMappingInvalidOverrideStrategyRule) Name() string { | ||
return "google_app_engine_domain_mapping_invalid_override_strategy" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleAppEngineDomainMappingInvalidOverrideStrategyRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleAppEngineDomainMappingInvalidOverrideStrategyRule) Severity() string { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleAppEngineDomainMappingInvalidOverrideStrategyRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleAppEngineDomainMappingInvalidOverrideStrategyRule) Check(runner tflint.Runner) error { | ||
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { | ||
var val string | ||
err := runner.EvaluateExpr(attribute.Expr, &val) | ||
|
||
validateFunc := validation.StringInSlice([]string{"STRICT", "OVERRIDE", ""}, false) | ||
|
||
return runner.EnsureNoError(err, func() error { | ||
_, errors := validateFunc(val, r.attributeName) | ||
for _, err := range errors { | ||
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr) | ||
} | ||
return nil | ||
}) | ||
}) | ||
} |
Oops, something went wrong.