Skip to content

Commit bf347ba

Browse files
wata727github-actions[bot]
authored andcommitted
Update Magic Modules
1 parent 002bcb8 commit bf347ba

File tree

4 files changed

+95
-1
lines changed

4 files changed

+95
-1
lines changed

rules/magicmodules/api_definition.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,11 @@ var APIDefinition = map[string]string{
394394
"google_integration_connectors_managed_zone": "connectors.googleapis.com",
395395
"google_integrations_auth_config": "integrations.googleapis.com",
396396
"google_integrations_client": "integrations.googleapis.com",
397+
"google_kms_autokey_config": "cloudkms.googleapis.com",
397398
"google_kms_crypto_key": "cloudkms.googleapis.com",
398399
"google_kms_crypto_key_version": "cloudkms.googleapis.com",
399400
"google_kms_ekm_connection": "cloudkms.googleapis.com",
401+
"google_kms_key_handle": "cloudkms.googleapis.com",
400402
"google_kms_key_ring": "cloudkms.googleapis.com",
401403
"google_kms_key_ring_import_job": "cloudkms.googleapis.com",
402404
"google_kms_secret_ciphertext": "cloudkms.googleapis.com",
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+
// GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule checks the pattern is valid
24+
type GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeBackendBucketInvalidLoadBalancingSchemeRule returns new rule with default attributes
32+
func NewGoogleComputeBackendBucketInvalidLoadBalancingSchemeRule() *GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule {
33+
return &GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule{
34+
resourceType: "google_compute_backend_bucket",
35+
attributeName: "load_balancing_scheme",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule) Name() string {
41+
return "google_compute_backend_bucket_invalid_load_balancing_scheme"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeBackendBucketInvalidLoadBalancingSchemeRule) 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{"INTERNAL_MANAGED", ""}, 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+
}

rules/magicmodules/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ var Rules = []tflint.Rule{
7878
NewGoogleComputeAddressInvalidNameRule(),
7979
NewGoogleComputeAddressInvalidNetworkTierRule(),
8080
NewGoogleComputeBackendBucketInvalidCompressionModeRule(),
81+
NewGoogleComputeBackendBucketInvalidLoadBalancingSchemeRule(),
8182
NewGoogleComputeBackendBucketInvalidNameRule(),
8283
NewGoogleComputeBackendBucketSignedUrlKeyInvalidNameRule(),
8384
NewGoogleComputeBackendServiceInvalidCompressionModeRule(),

tools/magic-modules

Submodule magic-modules updated 86 files

0 commit comments

Comments
 (0)