Skip to content

Commit ad861ab

Browse files
wata727github-actions[bot]
authored andcommitted
Update Magic Modules
1 parent 7b166f2 commit ad861ab

6 files changed

+281
-1
lines changed

rules/magicmodules/api_definition.go

+5
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ var APIDefinition = map[string]string{
198198
"google_compute_reservation": "compute.googleapis.com",
199199
"google_compute_resize_request": "compute.googleapis.com",
200200
"google_compute_resource_policy": "compute.googleapis.com",
201+
"google_compute_resource_policy_attachment": "compute.googleapis.com",
201202
"google_compute_route": "compute.googleapis.com",
202203
"google_compute_router": "compute.googleapis.com",
203204
"google_compute_router_nat": "compute.googleapis.com",
@@ -208,6 +209,7 @@ var APIDefinition = map[string]string{
208209
"google_compute_snapshot": "compute.googleapis.com",
209210
"google_compute_ssl_certificate": "compute.googleapis.com",
210211
"google_compute_ssl_policy": "compute.googleapis.com",
212+
"google_compute_storage_pool": "compute.googleapis.com",
211213
"google_compute_subnetwork": "compute.googleapis.com",
212214
"google_compute_target_grpc_proxy": "compute.googleapis.com",
213215
"google_compute_target_http_proxy": "compute.googleapis.com",
@@ -310,7 +312,9 @@ var APIDefinition = map[string]string{
310312
"google_gemini_release_channel_setting": "cloudaicompanion.googleapis.com",
311313
"google_gemini_release_channel_setting_binding": "cloudaicompanion.googleapis.com",
312314
"google_gemini_repository_group": "cloudaicompanion.googleapis.com",
315+
"google_gke_backup_backup_channel": "gkebackup.googleapis.com",
313316
"google_gke_backup_backup_plan": "gkebackup.googleapis.com",
317+
"google_gke_backup_restore_channel": "gkebackup.googleapis.com",
314318
"google_gke_backup_restore_plan": "gkebackup.googleapis.com",
315319
"google_gke_hub_feature": "gkehub.googleapis.com",
316320
"google_gke_hub_fleet": "gkehub.googleapis.com",
@@ -516,6 +520,7 @@ var APIDefinition = map[string]string{
516520
"google_sql_database": "sqladmin.googleapis.com",
517521
"google_sql_source_representation_instance": "sqladmin.googleapis.com",
518522
"google_storage_anywhere_cache": "storage.googleapis.com",
523+
"google_storage_batch_operations_job": "storagebatchoperations.googleapis.com",
519524
"google_storage_bucket_access_control": "storage.googleapis.com",
520525
"google_storage_control_folder_intelligence_config": "storage.googleapis.com",
521526
"google_storage_control_organization_intelligence_config": "storage.googleapis.com",
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+
// GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule checks the pattern is valid
24+
type GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule returns new rule with default attributes
32+
func NewGoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule() *GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule {
33+
return &GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule{
34+
resourceType: "google_compute_storage_pool",
35+
attributeName: "capacity_provisioning_type",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule) Name() string {
41+
return "google_compute_storage_pool_invalid_capacity_provisioning_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule) 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{"STANDARD", "ADVANCED", ""}, 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+
}
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+
// GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule checks the pattern is valid
24+
type GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule returns new rule with default attributes
32+
func NewGoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule() *GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule {
33+
return &GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule{
34+
resourceType: "google_compute_storage_pool",
35+
attributeName: "performance_provisioning_type",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule) Name() string {
41+
return "google_compute_storage_pool_invalid_performance_provisioning_type"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule) 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{"STANDARD", "ADVANCED", ""}, 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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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/terraform-linters/tflint-plugin-sdk/hclext"
19+
"github.com/terraform-linters/tflint-plugin-sdk/tflint"
20+
)
21+
22+
// GoogleStorageBatchOperationsJobInvalidJobIdRule checks the pattern is valid
23+
type GoogleStorageBatchOperationsJobInvalidJobIdRule struct {
24+
tflint.DefaultRule
25+
26+
resourceType string
27+
attributeName string
28+
}
29+
30+
// NewGoogleStorageBatchOperationsJobInvalidJobIdRule returns new rule with default attributes
31+
func NewGoogleStorageBatchOperationsJobInvalidJobIdRule() *GoogleStorageBatchOperationsJobInvalidJobIdRule {
32+
return &GoogleStorageBatchOperationsJobInvalidJobIdRule{
33+
resourceType: "google_storage_batch_operations_job",
34+
attributeName: "job_id",
35+
}
36+
}
37+
38+
// Name returns the rule name
39+
func (r *GoogleStorageBatchOperationsJobInvalidJobIdRule) Name() string {
40+
return "google_storage_batch_operations_job_invalid_job_id"
41+
}
42+
43+
// Enabled returns whether the rule is enabled by default
44+
func (r *GoogleStorageBatchOperationsJobInvalidJobIdRule) Enabled() bool {
45+
return true
46+
}
47+
48+
// Severity returns the rule severity
49+
func (r *GoogleStorageBatchOperationsJobInvalidJobIdRule) Severity() tflint.Severity {
50+
return tflint.ERROR
51+
}
52+
53+
// Link returns the rule reference link
54+
func (r *GoogleStorageBatchOperationsJobInvalidJobIdRule) Link() string {
55+
return ""
56+
}
57+
58+
// Check checks the pattern is valid
59+
func (r *GoogleStorageBatchOperationsJobInvalidJobIdRule) Check(runner tflint.Runner) error {
60+
resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{
61+
Attributes: []hclext.AttributeSchema{{Name: r.attributeName}},
62+
}, nil)
63+
if err != nil {
64+
return err
65+
}
66+
67+
for _, resource := range resources.Blocks {
68+
attribute, exists := resource.Body.Attributes[r.attributeName]
69+
if !exists {
70+
continue
71+
}
72+
73+
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
74+
validateFunc := validateRegexp(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?.$`)
75+
76+
_, errors := validateFunc(val, r.attributeName)
77+
for _, err := range errors {
78+
if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil {
79+
return err
80+
}
81+
}
82+
return nil
83+
}, nil)
84+
if err != nil {
85+
return err
86+
}
87+
}
88+
89+
return nil
90+
}

rules/magicmodules/provider.go

+3
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ var Rules = []tflint.Rule{
137137
NewGoogleComputeRouterRoutePolicyInvalidTypeRule(),
138138
NewGoogleComputeSslPolicyInvalidMinTlsVersionRule(),
139139
NewGoogleComputeSslPolicyInvalidProfileRule(),
140+
NewGoogleComputeStoragePoolInvalidCapacityProvisioningTypeRule(),
141+
NewGoogleComputeStoragePoolInvalidPerformanceProvisioningTypeRule(),
140142
NewGoogleComputeSubnetworkInvalidIpv6AccessTypeRule(),
141143
NewGoogleComputeSubnetworkInvalidRoleRule(),
142144
NewGoogleComputeSubnetworkInvalidStackTypeRule(),
@@ -290,6 +292,7 @@ var Rules = []tflint.Rule{
290292
NewGoogleSpannerInstanceInvalidNameRule(),
291293
NewGoogleSpannerInstancePartitionInvalidNameRule(),
292294
NewGoogleStorageAnywhereCacheInvalidAdmissionPolicyRule(),
295+
NewGoogleStorageBatchOperationsJobInvalidJobIdRule(),
293296
NewGoogleStorageBucketAccessControlInvalidRoleRule(),
294297
NewGoogleStorageDefaultObjectAccessControlInvalidRoleRule(),
295298
NewGoogleStorageHmacKeyInvalidStateRule(),

tools/magic-modules

Submodule magic-modules updated 219 files

0 commit comments

Comments
 (0)