Skip to content

Commit 3a478cc

Browse files
authored
Merge pull request #47 from terraform-linters/update_magic_modules
Update Magic Modules
2 parents 14bef9e + f382f7a commit 3a478cc

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-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+
// GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule checks the pattern is valid
24+
type GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule struct {
25+
resourceType string
26+
attributeName string
27+
}
28+
29+
// NewGoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule returns new rule with default attributes
30+
func NewGoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule() *GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule {
31+
return &GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule{
32+
resourceType: "google_compute_external_vpn_gateway",
33+
attributeName: "redundancy_type",
34+
}
35+
}
36+
37+
// Name returns the rule name
38+
func (r *GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule) Name() string {
39+
return "google_compute_external_vpn_gateway_invalid_redundancy_type"
40+
}
41+
42+
// Enabled returns whether the rule is enabled by default
43+
func (r *GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule) Enabled() bool {
44+
return true
45+
}
46+
47+
// Severity returns the rule severity
48+
func (r *GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule) Severity() string {
49+
return tflint.ERROR
50+
}
51+
52+
// Link returns the rule reference link
53+
func (r *GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule) Link() string {
54+
return ""
55+
}
56+
57+
// Check checks the pattern is valid
58+
func (r *GoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule) 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{"FOUR_IPS_REDUNDANCY", "SINGLE_IP_INTERNALLY_REDUNDANT", "TWO_IPS_REDUNDANCY", ""}, 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var Rules = []tflint.Rule{
4343
NewGoogleComputeBackendServiceInvalidProtocolRule(),
4444
NewGoogleComputeBackendServiceInvalidSessionAffinityRule(),
4545
NewGoogleComputeBackendServiceSignedUrlKeyInvalidNameRule(),
46+
NewGoogleComputeExternalVpnGatewayInvalidRedundancyTypeRule(),
4647
NewGoogleComputeFirewallInvalidDirectionRule(),
4748
NewGoogleComputeForwardingRuleInvalidIpProtocolRule(),
4849
NewGoogleComputeForwardingRuleInvalidLoadBalancingSchemeRule(),

tools/magic-modules

Submodule magic-modules updated 532 files

0 commit comments

Comments
 (0)