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.
- Loading branch information
Showing
151 changed files
with
2,394 additions
and
1,552 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
rules/magicmodules/google_access_context_manager_authorized_orgs_desc_invalid_asset_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,91 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// 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 ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/terraform-linters/tflint-plugin-sdk/hclext" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule checks the pattern is valid | ||
type GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule struct { | ||
tflint.DefaultRule | ||
|
||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule returns new rule with default attributes | ||
func NewGoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule() *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule { | ||
return &GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule{ | ||
resourceType: "google_access_context_manager_authorized_orgs_desc", | ||
attributeName: "asset_type", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule) Name() string { | ||
return "google_access_context_manager_authorized_orgs_desc_invalid_asset_type" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule) Severity() tflint.Severity { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAssetTypeRule) Check(runner tflint.Runner) error { | ||
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ | ||
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}}, | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for _, resource := range resources.Blocks { | ||
attribute, exists := resource.Body.Attributes[r.attributeName] | ||
if !exists { | ||
continue | ||
} | ||
|
||
err := runner.EvaluateExpr(attribute.Expr, func(val string) error { | ||
validateFunc := validation.StringInSlice([]string{"ASSET_TYPE_DEVICE", "ASSET_TYPE_CREDENTIAL_STRENGTH", ""}, false) | ||
|
||
_, errors := validateFunc(val, r.attributeName) | ||
for _, err := range errors { | ||
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
91 changes: 91 additions & 0 deletions
91
...les/google_access_context_manager_authorized_orgs_desc_invalid_authorization_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,91 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// 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 ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/terraform-linters/tflint-plugin-sdk/hclext" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule checks the pattern is valid | ||
type GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule struct { | ||
tflint.DefaultRule | ||
|
||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule returns new rule with default attributes | ||
func NewGoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule() *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule { | ||
return &GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule{ | ||
resourceType: "google_access_context_manager_authorized_orgs_desc", | ||
attributeName: "authorization_direction", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule) Name() string { | ||
return "google_access_context_manager_authorized_orgs_desc_invalid_authorization_direction" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule) Severity() tflint.Severity { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationDirectionRule) Check(runner tflint.Runner) error { | ||
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ | ||
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}}, | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for _, resource := range resources.Blocks { | ||
attribute, exists := resource.Body.Attributes[r.attributeName] | ||
if !exists { | ||
continue | ||
} | ||
|
||
err := runner.EvaluateExpr(attribute.Expr, func(val string) error { | ||
validateFunc := validation.StringInSlice([]string{"AUTHORIZATION_DIRECTION_TO", "AUTHORIZATION_DIRECTION_FROM", ""}, false) | ||
|
||
_, errors := validateFunc(val, r.attributeName) | ||
for _, err := range errors { | ||
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
91 changes: 91 additions & 0 deletions
91
...cmodules/google_access_context_manager_authorized_orgs_desc_invalid_authorization_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,91 @@ | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// *** AUTO GENERATED CODE *** Type: MMv1 *** | ||
// | ||
// ---------------------------------------------------------------------------- | ||
// | ||
// 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 ( | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/terraform-linters/tflint-plugin-sdk/hclext" | ||
"github.com/terraform-linters/tflint-plugin-sdk/tflint" | ||
) | ||
|
||
// GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule checks the pattern is valid | ||
type GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule struct { | ||
tflint.DefaultRule | ||
|
||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule returns new rule with default attributes | ||
func NewGoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule() *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule { | ||
return &GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule{ | ||
resourceType: "google_access_context_manager_authorized_orgs_desc", | ||
attributeName: "authorization_type", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule) Name() string { | ||
return "google_access_context_manager_authorized_orgs_desc_invalid_authorization_type" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule) Severity() tflint.Severity { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleAccessContextManagerAuthorizedOrgsDescInvalidAuthorizationTypeRule) Check(runner tflint.Runner) error { | ||
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ | ||
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}}, | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for _, resource := range resources.Blocks { | ||
attribute, exists := resource.Body.Attributes[r.attributeName] | ||
if !exists { | ||
continue | ||
} | ||
|
||
err := runner.EvaluateExpr(attribute.Expr, func(val string) error { | ||
validateFunc := validation.StringInSlice([]string{"AUTHORIZATION_TYPE_TRUST", ""}, false) | ||
|
||
_, errors := validateFunc(val, r.attributeName) | ||
for _, err := range errors { | ||
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
}, nil) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil | ||
} |
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
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
Oops, something went wrong.