Skip to content

Commit 8a8388e

Browse files
authored
Update Magic Modules (#352)
1 parent 6ae027b commit 8a8388e

17 files changed

+1524
-348
lines changed

rules/magicmodules/api_definition.go

Lines changed: 370 additions & 346 deletions
Large diffs are not rendered by default.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package magicmodules
16+
17+
import (
18+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
19+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleBigqueryRoutineInvalidDataGovernanceTypeRule checks the pattern is valid
24+
type GoogleBigqueryRoutineInvalidDataGovernanceTypeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleBigqueryRoutineInvalidDataGovernanceTypeRule returns new rule with default attributes
32+
func NewGoogleBigqueryRoutineInvalidDataGovernanceTypeRule() *GoogleBigqueryRoutineInvalidDataGovernanceTypeRule {
33+
return &GoogleBigqueryRoutineInvalidDataGovernanceTypeRule{
34+
resourceType: "google_bigquery_routine",
35+
attributeName: "data_governance_type",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleBigqueryRoutineInvalidDataGovernanceTypeRule) Name() string {
41+
return "google_bigquery_routine_invalid_data_governance_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleBigqueryRoutineInvalidDataGovernanceTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleBigqueryRoutineInvalidDataGovernanceTypeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleBigqueryRoutineInvalidDataGovernanceTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleBigqueryRoutineInvalidDataGovernanceTypeRule) Check(runner tflint.Runner) error {
61+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
62+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
63+
}, nil)
64+
if err != nil {
65+
return err
66+
}
67+
68+
for _, resource := range resources.Blocks {
69+
attribute, exists := resource.Body.Attributes[r.attributeName]
70+
if !exists {
71+
continue
72+
}
73+
74+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
75+
validateFunc := validation.StringInSlice([]string{"DATA_MASKING", ""}, false)
76+
77+
_, errors := validateFunc(val, r.attributeName)
78+
for _, err := range errors {
79+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
80+
return err
81+
}
82+
}
83+
return nil
84+
}, nil)
85+
if err != nil {
86+
return err
87+
}
88+
}
89+
90+
return nil
91+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package magicmodules
16+
17+
import (
18+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
19+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleBillingBudgetInvalidOwnershipScopeRule checks the pattern is valid
24+
type GoogleBillingBudgetInvalidOwnershipScopeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleBillingBudgetInvalidOwnershipScopeRule returns new rule with default attributes
32+
func NewGoogleBillingBudgetInvalidOwnershipScopeRule() *GoogleBillingBudgetInvalidOwnershipScopeRule {
33+
return &GoogleBillingBudgetInvalidOwnershipScopeRule{
34+
resourceType: "google_billing_budget",
35+
attributeName: "ownership_scope",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleBillingBudgetInvalidOwnershipScopeRule) Name() string {
41+
return "google_billing_budget_invalid_ownership_scope"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleBillingBudgetInvalidOwnershipScopeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleBillingBudgetInvalidOwnershipScopeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleBillingBudgetInvalidOwnershipScopeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleBillingBudgetInvalidOwnershipScopeRule) Check(runner tflint.Runner) error {
61+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
62+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
63+
}, nil)
64+
if err != nil {
65+
return err
66+
}
67+
68+
for _, resource := range resources.Blocks {
69+
attribute, exists := resource.Body.Attributes[r.attributeName]
70+
if !exists {
71+
continue
72+
}
73+
74+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
75+
validateFunc := validation.StringInSlice([]string{"OWNERSHIP_SCOPE_UNSPECIFIED", "ALL_USERS", "BILLING_ACCOUNT", ""}, false)
76+
77+
_, errors := validateFunc(val, r.attributeName)
78+
for _, err := range errors {
79+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
80+
return err
81+
}
82+
}
83+
return nil
84+
}, nil)
85+
if err != nil {
86+
return err
87+
}
88+
}
89+
90+
return nil
91+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package magicmodules
16+
17+
import (
18+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
19+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleCertificateManagerDnsAuthorizationInvalidTypeRule checks the pattern is valid
24+
type GoogleCertificateManagerDnsAuthorizationInvalidTypeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleCertificateManagerDnsAuthorizationInvalidTypeRule returns new rule with default attributes
32+
func NewGoogleCertificateManagerDnsAuthorizationInvalidTypeRule() *GoogleCertificateManagerDnsAuthorizationInvalidTypeRule {
33+
return &GoogleCertificateManagerDnsAuthorizationInvalidTypeRule{
34+
resourceType: "google_certificate_manager_dns_authorization",
35+
attributeName: "type",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleCertificateManagerDnsAuthorizationInvalidTypeRule) Name() string {
41+
return "google_certificate_manager_dns_authorization_invalid_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleCertificateManagerDnsAuthorizationInvalidTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleCertificateManagerDnsAuthorizationInvalidTypeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleCertificateManagerDnsAuthorizationInvalidTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleCertificateManagerDnsAuthorizationInvalidTypeRule) Check(runner tflint.Runner) error {
61+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
62+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
63+
}, nil)
64+
if err != nil {
65+
return err
66+
}
67+
68+
for _, resource := range resources.Blocks {
69+
attribute, exists := resource.Body.Attributes[r.attributeName]
70+
if !exists {
71+
continue
72+
}
73+
74+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
75+
validateFunc := validation.StringInSlice([]string{"FIXED_RECORD", "PER_PROJECT_RECORD", ""}, false)
76+
77+
_, errors := validateFunc(val, r.attributeName)
78+
for _, err := range errors {
79+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
80+
return err
81+
}
82+
}
83+
return nil
84+
}, nil)
85+
if err != nil {
86+
return err
87+
}
88+
}
89+
90+
return nil
91+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
4+
//
5+
// ----------------------------------------------------------------------------
6+
//
7+
// This file is automatically generated by Magic Modules and manual
8+
// changes will be clobbered when the file is regenerated.
9+
//
10+
// Please read more about how to change this file in
11+
// .github/CONTRIBUTING.md.
12+
//
13+
// ----------------------------------------------------------------------------
14+
15+
package magicmodules
16+
17+
import (
18+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
19+
"github.com/terraform-linters/tflint-plugin-sdk/hclext"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule checks the pattern is valid
24+
type GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule returns new rule with default attributes
32+
func NewGoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule() *GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule {
33+
return &GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule{
34+
resourceType: "google_cloud_quotas_quota_preference",
35+
attributeName: "ignore_safety_checks",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule) Name() string {
41+
return "google_cloud_quotas_quota_preference_invalid_ignore_safety_checks"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleCloudQuotasQuotaPreferenceInvalidIgnoreSafetyChecksRule) Check(runner tflint.Runner) error {
61+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
62+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
63+
}, nil)
64+
if err != nil {
65+
return err
66+
}
67+
68+
for _, resource := range resources.Blocks {
69+
attribute, exists := resource.Body.Attributes[r.attributeName]
70+
if !exists {
71+
continue
72+
}
73+
74+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
75+
validateFunc := validation.StringInSlice([]string{"QUOTA_SAFETY_CHECK_UNSPECIFIED", "QUOTA_DECREASE_BELOW_USAGE", "QUOTA_DECREASE_PERCENTAGE_TOO_HIGH", ""}, false)
76+
77+
_, errors := validateFunc(val, r.attributeName)
78+
for _, err := range errors {
79+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
80+
return err
81+
}
82+
}
83+
return nil
84+
}, nil)
85+
if err != nil {
86+
return err
87+
}
88+
}
89+
90+
return nil
91+
}

0 commit comments

Comments
 (0)