Skip to content

Commit ba39f15

Browse files
authored
Update Magic Modules (#64)
1 parent 1ea1a07 commit ba39f15

7 files changed

+298
-2
lines changed

rules/magicmodules/google_compute_address_invalid_purpose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (r *GoogleComputeAddressInvalidPurposeRule) Check(runner tflint.Runner) err
6060
var val string
6161
err := runner.EvaluateExpr(attribute.Expr, &val)
6262

63-
validateFunc := validation.StringInSlice([]string{"GCE_ENDPOINT", ""}, false)
63+
validateFunc := validation.StringInSlice([]string{"GCE_ENDPOINT", "VPC_PEERING", "SHARED_LOADBALANCER_VIP", ""}, false)
6464

6565
return runner.EnsureNoError(err, func() error {
6666
_, errors := validateFunc(val, r.attributeName)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
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+
hcl "github.com/hashicorp/hcl/v2"
19+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleComputeManagedSslCertificateInvalidTypeRule checks the pattern is valid
24+
type GoogleComputeManagedSslCertificateInvalidTypeRule struct {
25+
resourceType string
26+
attributeName string
27+
}
28+
29+
// NewGoogleComputeManagedSslCertificateInvalidTypeRule returns new rule with default attributes
30+
func NewGoogleComputeManagedSslCertificateInvalidTypeRule() *GoogleComputeManagedSslCertificateInvalidTypeRule {
31+
return &GoogleComputeManagedSslCertificateInvalidTypeRule{
32+
resourceType: "google_compute_managed_ssl_certificate",
33+
attributeName: "type",
34+
}
35+
}
36+
37+
// Name returns the rule name
38+
func (r *GoogleComputeManagedSslCertificateInvalidTypeRule) Name() string {
39+
return "google_compute_managed_ssl_certificate_invalid_type"
40+
}
41+
42+
// Enabled returns whether the rule is enabled by default
43+
func (r *GoogleComputeManagedSslCertificateInvalidTypeRule) Enabled() bool {
44+
return true
45+
}
46+
47+
// Severity returns the rule severity
48+
func (r *GoogleComputeManagedSslCertificateInvalidTypeRule) Severity() string {
49+
return tflint.ERROR
50+
}
51+
52+
// Link returns the rule reference link
53+
func (r *GoogleComputeManagedSslCertificateInvalidTypeRule) Link() string {
54+
return ""
55+
}
56+
57+
// Check checks the pattern is valid
58+
func (r *GoogleComputeManagedSslCertificateInvalidTypeRule) Check(runner tflint.Runner) error {
59+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
60+
var val string
61+
err := runner.EvaluateExpr(attribute.Expr, &val)
62+
63+
validateFunc := validation.StringInSlice([]string{"MANAGED", ""}, false)
64+
65+
return runner.EnsureNoError(err, func() error {
66+
_, errors := validateFunc(val, r.attributeName)
67+
for _, err := range errors {
68+
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr)
69+
}
70+
return nil
71+
})
72+
})
73+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
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+
hcl "github.com/hashicorp/hcl/v2"
19+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleNotebooksInstanceInvalidBootDiskTypeRule checks the pattern is valid
24+
type GoogleNotebooksInstanceInvalidBootDiskTypeRule struct {
25+
resourceType string
26+
attributeName string
27+
}
28+
29+
// NewGoogleNotebooksInstanceInvalidBootDiskTypeRule returns new rule with default attributes
30+
func NewGoogleNotebooksInstanceInvalidBootDiskTypeRule() *GoogleNotebooksInstanceInvalidBootDiskTypeRule {
31+
return &GoogleNotebooksInstanceInvalidBootDiskTypeRule{
32+
resourceType: "google_notebooks_instance",
33+
attributeName: "boot_disk_type",
34+
}
35+
}
36+
37+
// Name returns the rule name
38+
func (r *GoogleNotebooksInstanceInvalidBootDiskTypeRule) Name() string {
39+
return "google_notebooks_instance_invalid_boot_disk_type"
40+
}
41+
42+
// Enabled returns whether the rule is enabled by default
43+
func (r *GoogleNotebooksInstanceInvalidBootDiskTypeRule) Enabled() bool {
44+
return true
45+
}
46+
47+
// Severity returns the rule severity
48+
func (r *GoogleNotebooksInstanceInvalidBootDiskTypeRule) Severity() string {
49+
return tflint.ERROR
50+
}
51+
52+
// Link returns the rule reference link
53+
func (r *GoogleNotebooksInstanceInvalidBootDiskTypeRule) Link() string {
54+
return ""
55+
}
56+
57+
// Check checks the pattern is valid
58+
func (r *GoogleNotebooksInstanceInvalidBootDiskTypeRule) Check(runner tflint.Runner) error {
59+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
60+
var val string
61+
err := runner.EvaluateExpr(attribute.Expr, &val)
62+
63+
validateFunc := validation.StringInSlice([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", ""}, false)
64+
65+
return runner.EnsureNoError(err, func() error {
66+
_, errors := validateFunc(val, r.attributeName)
67+
for _, err := range errors {
68+
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr)
69+
}
70+
return nil
71+
})
72+
})
73+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
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+
hcl "github.com/hashicorp/hcl/v2"
19+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleNotebooksInstanceInvalidDataDiskTypeRule checks the pattern is valid
24+
type GoogleNotebooksInstanceInvalidDataDiskTypeRule struct {
25+
resourceType string
26+
attributeName string
27+
}
28+
29+
// NewGoogleNotebooksInstanceInvalidDataDiskTypeRule returns new rule with default attributes
30+
func NewGoogleNotebooksInstanceInvalidDataDiskTypeRule() *GoogleNotebooksInstanceInvalidDataDiskTypeRule {
31+
return &GoogleNotebooksInstanceInvalidDataDiskTypeRule{
32+
resourceType: "google_notebooks_instance",
33+
attributeName: "data_disk_type",
34+
}
35+
}
36+
37+
// Name returns the rule name
38+
func (r *GoogleNotebooksInstanceInvalidDataDiskTypeRule) Name() string {
39+
return "google_notebooks_instance_invalid_data_disk_type"
40+
}
41+
42+
// Enabled returns whether the rule is enabled by default
43+
func (r *GoogleNotebooksInstanceInvalidDataDiskTypeRule) Enabled() bool {
44+
return true
45+
}
46+
47+
// Severity returns the rule severity
48+
func (r *GoogleNotebooksInstanceInvalidDataDiskTypeRule) Severity() string {
49+
return tflint.ERROR
50+
}
51+
52+
// Link returns the rule reference link
53+
func (r *GoogleNotebooksInstanceInvalidDataDiskTypeRule) Link() string {
54+
return ""
55+
}
56+
57+
// Check checks the pattern is valid
58+
func (r *GoogleNotebooksInstanceInvalidDataDiskTypeRule) Check(runner tflint.Runner) error {
59+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
60+
var val string
61+
err := runner.EvaluateExpr(attribute.Expr, &val)
62+
63+
validateFunc := validation.StringInSlice([]string{"DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", ""}, false)
64+
65+
return runner.EnsureNoError(err, func() error {
66+
_, errors := validateFunc(val, r.attributeName)
67+
for _, err := range errors {
68+
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr)
69+
}
70+
return nil
71+
})
72+
})
73+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
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+
hcl "github.com/hashicorp/hcl/v2"
19+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
20+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
21+
)
22+
23+
// GoogleNotebooksInstanceInvalidDiskEncryptionRule checks the pattern is valid
24+
type GoogleNotebooksInstanceInvalidDiskEncryptionRule struct {
25+
resourceType string
26+
attributeName string
27+
}
28+
29+
// NewGoogleNotebooksInstanceInvalidDiskEncryptionRule returns new rule with default attributes
30+
func NewGoogleNotebooksInstanceInvalidDiskEncryptionRule() *GoogleNotebooksInstanceInvalidDiskEncryptionRule {
31+
return &GoogleNotebooksInstanceInvalidDiskEncryptionRule{
32+
resourceType: "google_notebooks_instance",
33+
attributeName: "disk_encryption",
34+
}
35+
}
36+
37+
// Name returns the rule name
38+
func (r *GoogleNotebooksInstanceInvalidDiskEncryptionRule) Name() string {
39+
return "google_notebooks_instance_invalid_disk_encryption"
40+
}
41+
42+
// Enabled returns whether the rule is enabled by default
43+
func (r *GoogleNotebooksInstanceInvalidDiskEncryptionRule) Enabled() bool {
44+
return true
45+
}
46+
47+
// Severity returns the rule severity
48+
func (r *GoogleNotebooksInstanceInvalidDiskEncryptionRule) Severity() string {
49+
return tflint.ERROR
50+
}
51+
52+
// Link returns the rule reference link
53+
func (r *GoogleNotebooksInstanceInvalidDiskEncryptionRule) Link() string {
54+
return ""
55+
}
56+
57+
// Check checks the pattern is valid
58+
func (r *GoogleNotebooksInstanceInvalidDiskEncryptionRule) Check(runner tflint.Runner) error {
59+
return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error {
60+
var val string
61+
err := runner.EvaluateExpr(attribute.Expr, &val)
62+
63+
validateFunc := validation.StringInSlice([]string{"DISK_ENCRYPTION_UNSPECIFIED", "GMEK", "CMEK", ""}, false)
64+
65+
return runner.EnsureNoError(err, func() error {
66+
_, errors := validateFunc(val, r.attributeName)
67+
for _, err := range errors {
68+
runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr)
69+
}
70+
return nil
71+
})
72+
})
73+
}

rules/magicmodules/provider.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ var Rules = []tflint.Rule{
6161
NewGoogleComputeInterconnectAttachmentInvalidBandwidthRule(),
6262
NewGoogleComputeInterconnectAttachmentInvalidNameRule(),
6363
NewGoogleComputeInterconnectAttachmentInvalidTypeRule(),
64+
NewGoogleComputeManagedSslCertificateInvalidTypeRule(),
6465
NewGoogleComputeNetworkEndpointGroupInvalidNetworkEndpointTypeRule(),
6566
NewGoogleComputeRegionBackendServiceInvalidLoadBalancingSchemeRule(),
6667
NewGoogleComputeRegionBackendServiceInvalidLocalityLbPolicyRule(),
@@ -105,6 +106,9 @@ var Rules = []tflint.Rule{
105106
NewGoogleMonitoringMetricDescriptorInvalidValueTypeRule(),
106107
NewGoogleMonitoringSloInvalidCalendarPeriodRule(),
107108
NewGoogleMonitoringSloInvalidSloIdRule(),
109+
NewGoogleNotebooksInstanceInvalidBootDiskTypeRule(),
110+
NewGoogleNotebooksInstanceInvalidDataDiskTypeRule(),
111+
NewGoogleNotebooksInstanceInvalidDiskEncryptionRule(),
108112
NewGoogleOsConfigPatchDeploymentInvalidPatchDeploymentIdRule(),
109113
NewGoogleRedisInstanceInvalidConnectModeRule(),
110114
NewGoogleRedisInstanceInvalidNameRule(),

tools/magic-modules

Submodule magic-modules updated 239 files

0 commit comments

Comments
 (0)