Skip to content

Commit 7d57a87

Browse files
authored
Update Magic Modules (#98)
1 parent 77affcf commit 7d57a87

File tree

5 files changed

+159
-1
lines changed

5 files changed

+159
-1
lines changed
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+
// GoogleComputeInterconnectAttachmentInvalidEncryptionRule checks the pattern is valid
24+
type GoogleComputeInterconnectAttachmentInvalidEncryptionRule struct {
25+
resourceType string
26+
attributeName string
27+
}
28+
29+
// NewGoogleComputeInterconnectAttachmentInvalidEncryptionRule returns new rule with default attributes
30+
func NewGoogleComputeInterconnectAttachmentInvalidEncryptionRule() *GoogleComputeInterconnectAttachmentInvalidEncryptionRule {
31+
return &GoogleComputeInterconnectAttachmentInvalidEncryptionRule{
32+
resourceType: "google_compute_interconnect_attachment",
33+
attributeName: "encryption",
34+
}
35+
}
36+
37+
// Name returns the rule name
38+
func (r *GoogleComputeInterconnectAttachmentInvalidEncryptionRule) Name() string {
39+
return "google_compute_interconnect_attachment_invalid_encryption"
40+
}
41+
42+
// Enabled returns whether the rule is enabled by default
43+
func (r *GoogleComputeInterconnectAttachmentInvalidEncryptionRule) Enabled() bool {
44+
return true
45+
}
46+
47+
// Severity returns the rule severity
48+
func (r *GoogleComputeInterconnectAttachmentInvalidEncryptionRule) Severity() string {
49+
return tflint.ERROR
50+
}
51+
52+
// Link returns the rule reference link
53+
func (r *GoogleComputeInterconnectAttachmentInvalidEncryptionRule) Link() string {
54+
return ""
55+
}
56+
57+
// Check checks the pattern is valid
58+
func (r *GoogleComputeInterconnectAttachmentInvalidEncryptionRule) 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, nil)
62+
63+
validateFunc := validation.StringInSlice([]string{"NONE", "IPSEC", ""}, 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+
// GooglePubsubSchemaInvalidTypeRule checks the pattern is valid
24+
type GooglePubsubSchemaInvalidTypeRule struct {
25+
resourceType string
26+
attributeName string
27+
}
28+
29+
// NewGooglePubsubSchemaInvalidTypeRule returns new rule with default attributes
30+
func NewGooglePubsubSchemaInvalidTypeRule() *GooglePubsubSchemaInvalidTypeRule {
31+
return &GooglePubsubSchemaInvalidTypeRule{
32+
resourceType: "google_pubsub_schema",
33+
attributeName: "type",
34+
}
35+
}
36+
37+
// Name returns the rule name
38+
func (r *GooglePubsubSchemaInvalidTypeRule) Name() string {
39+
return "google_pubsub_schema_invalid_type"
40+
}
41+
42+
// Enabled returns whether the rule is enabled by default
43+
func (r *GooglePubsubSchemaInvalidTypeRule) Enabled() bool {
44+
return true
45+
}
46+
47+
// Severity returns the rule severity
48+
func (r *GooglePubsubSchemaInvalidTypeRule) Severity() string {
49+
return tflint.ERROR
50+
}
51+
52+
// Link returns the rule reference link
53+
func (r *GooglePubsubSchemaInvalidTypeRule) Link() string {
54+
return ""
55+
}
56+
57+
// Check checks the pattern is valid
58+
func (r *GooglePubsubSchemaInvalidTypeRule) 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, nil)
62+
63+
validateFunc := validation.StringInSlice([]string{"TYPE_UNSPECIFIED", "PROTOCOL_BUFFER", "AVRO", ""}, 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/product.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ var Products = map[string]Product{
132132
{Name: "Dialogflow API", URL: "https://console.cloud.google.com/apis/library/dialogflow.googleapis.com"},
133133
},
134134
},
135+
"google_dialogflow_fulfillment": {
136+
APIsRequired: []APIReference{
137+
{Name: "Dialogflow API", URL: "https://console.cloud.google.com/apis/library/dialogflow.googleapis.com"},
138+
},
139+
},
135140
"google_firestore_index": {
136141
APIsRequired: []APIReference{},
137142
},
@@ -775,6 +780,11 @@ var Products = map[string]Product{
775780
{Name: "Cloud Pub/Sub API", URL: "https://console.cloud.google.com/apis/library/pubsub.googleapis.com/"},
776781
},
777782
},
783+
"google_pubsub_schema": {
784+
APIsRequired: []APIReference{
785+
{Name: "Cloud Pub/Sub API", URL: "https://console.cloud.google.com/apis/library/pubsub.googleapis.com/"},
786+
},
787+
},
778788
"google_spanner_instance": {
779789
APIsRequired: []APIReference{
780790
{Name: "Cloud Spanner API", URL: "https://console.cloud.google.com/apis/library/spanner.googleapis.com/"},

rules/magicmodules/provider.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var Rules = []tflint.Rule{
6060
NewGoogleComputeGlobalForwardingRuleInvalidLoadBalancingSchemeRule(),
6161
NewGoogleComputeGlobalNetworkEndpointGroupInvalidNetworkEndpointTypeRule(),
6262
NewGoogleComputeInterconnectAttachmentInvalidBandwidthRule(),
63+
NewGoogleComputeInterconnectAttachmentInvalidEncryptionRule(),
6364
NewGoogleComputeInterconnectAttachmentInvalidNameRule(),
6465
NewGoogleComputeInterconnectAttachmentInvalidTypeRule(),
6566
NewGoogleComputeManagedSslCertificateInvalidTypeRule(),
@@ -114,6 +115,7 @@ var Rules = []tflint.Rule{
114115
NewGoogleNotebooksInstanceInvalidDataDiskTypeRule(),
115116
NewGoogleNotebooksInstanceInvalidDiskEncryptionRule(),
116117
NewGoogleOsConfigPatchDeploymentInvalidPatchDeploymentIdRule(),
118+
NewGooglePubsubSchemaInvalidTypeRule(),
117119
NewGoogleRedisInstanceInvalidConnectModeRule(),
118120
NewGoogleRedisInstanceInvalidNameRule(),
119121
NewGoogleRedisInstanceInvalidTierRule(),

tools/magic-modules

Submodule magic-modules updated 137 files

0 commit comments

Comments
 (0)