Skip to content

Commit 1bcb6c3

Browse files
authored
Update Magic Modules (#197)
1 parent 0f3bb19 commit 1bcb6c3

12 files changed

+500
-5
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
// GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule checks the pattern is valid
24+
type GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleCertificateManagerCertificateMapEntryInvalidMatcherRule returns new rule with default attributes
32+
func NewGoogleCertificateManagerCertificateMapEntryInvalidMatcherRule() *GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule {
33+
return &GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule{
34+
resourceType: "google_certificate_manager_certificate_map_entry",
35+
attributeName: "matcher",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule) Name() string {
41+
return "google_certificate_manager_certificate_map_entry_invalid_matcher"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleCertificateManagerCertificateMapEntryInvalidMatcherRule) 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+
var val string
75+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
76+
77+
validateFunc := validation.StringInSlice([]string{"MATCHER_UNSPECIFIED", "PRIMARY", ""}, false)
78+
79+
err = runner.EnsureNoError(err, func() error {
80+
_, errors := validateFunc(val, r.attributeName)
81+
for _, err := range errors {
82+
runner.EmitIssue(r, err.Error(), attribute.Expr.Range())
83+
}
84+
return nil
85+
})
86+
if err != nil {
87+
return err
88+
}
89+
}
90+
91+
return nil
92+
}

rules/magicmodules/google_compute_network_endpoint_group_invalid_network_endpoint_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (r *GoogleComputeNetworkEndpointGroupInvalidNetworkEndpointTypeRule) Check(
7474
var val string
7575
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
7676

77-
validateFunc := validation.StringInSlice([]string{"GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT", ""}, false)
77+
validateFunc := validation.StringInSlice([]string{"GCE_VM_IP", "GCE_VM_IP_PORT", "NON_GCP_PRIVATE_IP_PORT", ""}, false)
7878

7979
err = runner.EnsureNoError(err, func() error {
8080
_, errors := validateFunc(val, r.attributeName)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
// GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule checks the pattern is valid
24+
type GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleDataprocMetastoreServiceInvalidDatabaseTypeRule returns new rule with default attributes
32+
func NewGoogleDataprocMetastoreServiceInvalidDatabaseTypeRule() *GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule {
33+
return &GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule{
34+
resourceType: "google_dataproc_metastore_service",
35+
attributeName: "database_type",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule) Name() string {
41+
return "google_dataproc_metastore_service_invalid_database_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleDataprocMetastoreServiceInvalidDatabaseTypeRule) 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+
var val string
75+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
76+
77+
validateFunc := validation.StringInSlice([]string{"MYSQL", "SPANNER", ""}, false)
78+
79+
err = runner.EnsureNoError(err, func() error {
80+
_, errors := validateFunc(val, r.attributeName)
81+
for _, err := range errors {
82+
runner.EmitIssue(r, err.Error(), attribute.Expr.Range())
83+
}
84+
return nil
85+
})
86+
if err != nil {
87+
return err
88+
}
89+
}
90+
91+
return nil
92+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
// GoogleDataprocMetastoreServiceInvalidReleaseChannelRule checks the pattern is valid
24+
type GoogleDataprocMetastoreServiceInvalidReleaseChannelRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleDataprocMetastoreServiceInvalidReleaseChannelRule returns new rule with default attributes
32+
func NewGoogleDataprocMetastoreServiceInvalidReleaseChannelRule() *GoogleDataprocMetastoreServiceInvalidReleaseChannelRule {
33+
return &GoogleDataprocMetastoreServiceInvalidReleaseChannelRule{
34+
resourceType: "google_dataproc_metastore_service",
35+
attributeName: "release_channel",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleDataprocMetastoreServiceInvalidReleaseChannelRule) Name() string {
41+
return "google_dataproc_metastore_service_invalid_release_channel"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleDataprocMetastoreServiceInvalidReleaseChannelRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleDataprocMetastoreServiceInvalidReleaseChannelRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleDataprocMetastoreServiceInvalidReleaseChannelRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleDataprocMetastoreServiceInvalidReleaseChannelRule) 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+
var val string
75+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
76+
77+
validateFunc := validation.StringInSlice([]string{"CANARY", "STABLE", ""}, false)
78+
79+
err = runner.EnsureNoError(err, func() error {
80+
_, errors := validateFunc(val, r.attributeName)
81+
for _, err := range errors {
82+
runner.EmitIssue(r, err.Error(), attribute.Expr.Range())
83+
}
84+
return nil
85+
})
86+
if err != nil {
87+
return err
88+
}
89+
}
90+
91+
return nil
92+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
// GoogleDataprocMetastoreServiceInvalidTierRule checks the pattern is valid
24+
type GoogleDataprocMetastoreServiceInvalidTierRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleDataprocMetastoreServiceInvalidTierRule returns new rule with default attributes
32+
func NewGoogleDataprocMetastoreServiceInvalidTierRule() *GoogleDataprocMetastoreServiceInvalidTierRule {
33+
return &GoogleDataprocMetastoreServiceInvalidTierRule{
34+
resourceType: "google_dataproc_metastore_service",
35+
attributeName: "tier",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleDataprocMetastoreServiceInvalidTierRule) Name() string {
41+
return "google_dataproc_metastore_service_invalid_tier"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleDataprocMetastoreServiceInvalidTierRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleDataprocMetastoreServiceInvalidTierRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleDataprocMetastoreServiceInvalidTierRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleDataprocMetastoreServiceInvalidTierRule) 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+
var val string
75+
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
76+
77+
validateFunc := validation.StringInSlice([]string{"DEVELOPER", "ENTERPRISE", ""}, false)
78+
79+
err = runner.EnsureNoError(err, func() error {
80+
_, errors := validateFunc(val, r.attributeName)
81+
for _, err := range errors {
82+
runner.EmitIssue(r, err.Error(), attribute.Expr.Range())
83+
}
84+
return nil
85+
})
86+
if err != nil {
87+
return err
88+
}
89+
}
90+
91+
return nil
92+
}

rules/magicmodules/google_kms_crypto_key_invalid_purpose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (r *GoogleKmsCryptoKeyInvalidPurposeRule) Check(runner tflint.Runner) error
7474
var val string
7575
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
7676

77-
validateFunc := validation.StringInSlice([]string{"ENCRYPT_DECRYPT", "ASYMMETRIC_SIGN", "ASYMMETRIC_DECRYPT", ""}, false)
77+
validateFunc := validation.StringInSlice([]string{"ENCRYPT_DECRYPT", "ASYMMETRIC_SIGN", "ASYMMETRIC_DECRYPT", "MAC", ""}, false)
7878

7979
err = runner.EnsureNoError(err, func() error {
8080
_, errors := validateFunc(val, r.attributeName)

rules/magicmodules/google_notebooks_instance_invalid_boot_disk_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (r *GoogleNotebooksInstanceInvalidBootDiskTypeRule) Check(runner tflint.Run
7474
var val string
7575
err := runner.EvaluateExpr(attribute.Expr, &val, nil)
7676

77-
validateFunc := validation.StringInSlice([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", ""}, false)
77+
validateFunc := validation.StringInSlice([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME", ""}, false)
7878

7979
err = runner.EnsureNoError(err, func() error {
8080
_, errors := validateFunc(val, r.attributeName)

0 commit comments

Comments
 (0)