generated from terraform-linters/tflint-ruleset-template
-
Notifications
You must be signed in to change notification settings - Fork 19
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
12 changed files
with
1,143 additions
and
386 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
rules/magicmodules/google_compute_network_attachment_invalid_connection_preference.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" | ||
) | ||
|
||
// GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule checks the pattern is valid | ||
type GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule struct { | ||
tflint.DefaultRule | ||
|
||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule returns new rule with default attributes | ||
func NewGoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule() *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule { | ||
return &GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule{ | ||
resourceType: "google_compute_network_attachment", | ||
attributeName: "connection_preference", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Name() string { | ||
return "google_compute_network_attachment_invalid_connection_preference" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Severity() tflint.Severity { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) 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{"ACCEPT_AUTOMATIC", "ACCEPT_MANUAL", "INVALID"}, 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
rules/magicmodules/google_compute_project_cloud_armor_tier_invalid_cloud_armor_tier.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" | ||
) | ||
|
||
// GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule checks the pattern is valid | ||
type GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule struct { | ||
tflint.DefaultRule | ||
|
||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule returns new rule with default attributes | ||
func NewGoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule() *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule { | ||
return &GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule{ | ||
resourceType: "google_compute_project_cloud_armor_tier", | ||
attributeName: "cloud_armor_tier", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Name() string { | ||
return "google_compute_project_cloud_armor_tier_invalid_cloud_armor_tier" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Severity() tflint.Severity { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) 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{"CA_STANDARD", "CA_ENTERPRISE_PAYGO"}, 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
91 changes: 91 additions & 0 deletions
91
rules/magicmodules/google_compute_target_https_proxy_invalid_tls_early_data.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" | ||
) | ||
|
||
// GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule checks the pattern is valid | ||
type GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule struct { | ||
tflint.DefaultRule | ||
|
||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule returns new rule with default attributes | ||
func NewGoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule() *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule { | ||
return &GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule{ | ||
resourceType: "google_compute_target_https_proxy", | ||
attributeName: "tls_early_data", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Name() string { | ||
return "google_compute_target_https_proxy_invalid_tls_early_data" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Severity() tflint.Severity { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) 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{"STRICT", "PERMISSIVE", "DISABLED", ""}, 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
...scc_management_folder_security_health_analytics_custom_module_invalid_enablement_state.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" | ||
) | ||
|
||
// GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule checks the pattern is valid | ||
type GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule struct { | ||
tflint.DefaultRule | ||
|
||
resourceType string | ||
attributeName string | ||
} | ||
|
||
// NewGoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule returns new rule with default attributes | ||
func NewGoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule() *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule { | ||
return &GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule{ | ||
resourceType: "google_scc_management_folder_security_health_analytics_custom_module", | ||
attributeName: "enablement_state", | ||
} | ||
} | ||
|
||
// Name returns the rule name | ||
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Name() string { | ||
return "google_scc_management_folder_security_health_analytics_custom_module_invalid_enablement_state" | ||
} | ||
|
||
// Enabled returns whether the rule is enabled by default | ||
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Enabled() bool { | ||
return true | ||
} | ||
|
||
// Severity returns the rule severity | ||
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Severity() tflint.Severity { | ||
return tflint.ERROR | ||
} | ||
|
||
// Link returns the rule reference link | ||
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Link() string { | ||
return "" | ||
} | ||
|
||
// Check checks the pattern is valid | ||
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) 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{"ENABLED", "DISABLED", ""}, 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 | ||
} |
Oops, something went wrong.