Skip to content

Commit d4819d3

Browse files
authored
Update Magic Modules (#372)
1 parent 03b69d4 commit d4819d3

12 files changed

+1143
-386
lines changed

rules/magicmodules/api_definition.go

Lines changed: 406 additions & 384 deletions
Large diffs are not rendered by default.
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+
// GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule checks the pattern is valid
24+
type GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule returns new rule with default attributes
32+
func NewGoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule() *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule {
33+
return &GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule{
34+
resourceType: "google_compute_network_attachment",
35+
attributeName: "connection_preference",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Name() string {
41+
return "google_compute_network_attachment_invalid_connection_preference"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeNetworkAttachmentInvalidConnectionPreferenceRule) 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{"ACCEPT_AUTOMATIC", "ACCEPT_MANUAL", "INVALID"}, 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+
}
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+
// GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule checks the pattern is valid
24+
type GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule returns new rule with default attributes
32+
func NewGoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule() *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule {
33+
return &GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule{
34+
resourceType: "google_compute_project_cloud_armor_tier",
35+
attributeName: "cloud_armor_tier",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Name() string {
41+
return "google_compute_project_cloud_armor_tier_invalid_cloud_armor_tier"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeProjectCloudArmorTierInvalidCloudArmorTierRule) 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{"CA_STANDARD", "CA_ENTERPRISE_PAYGO"}, 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/google_compute_region_network_endpoint_group_invalid_network_endpoint_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (r *GoogleComputeRegionNetworkEndpointGroupInvalidNetworkEndpointTypeRule)
7272
}
7373

7474
err := runner.EvaluateExpr(attribute.Expr, func(val string) error {
75-
validateFunc := validation.StringInSlice([]string{"SERVERLESS", "PRIVATE_SERVICE_CONNECT", "INTERNET_IP_PORT", "INTERNET_FQDN_PORT", ""}, false)
75+
validateFunc := validation.StringInSlice([]string{"SERVERLESS", "PRIVATE_SERVICE_CONNECT", "INTERNET_IP_PORT", "INTERNET_FQDN_PORT", "GCE_VM_IP_PORTMAP", ""}, false)
7676

7777
_, errors := validateFunc(val, r.attributeName)
7878
for _, err := range errors {
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+
// GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule checks the pattern is valid
24+
type GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule returns new rule with default attributes
32+
func NewGoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule() *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule {
33+
return &GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule{
34+
resourceType: "google_compute_target_https_proxy",
35+
attributeName: "tls_early_data",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Name() string {
41+
return "google_compute_target_https_proxy_invalid_tls_early_data"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleComputeTargetHttpsProxyInvalidTlsEarlyDataRule) 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{"STRICT", "PERMISSIVE", "DISABLED", ""}, 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+
// GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule checks the pattern is valid
24+
type GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule struct {
25+
tflint.DefaultRule
26+
27+
resourceType string
28+
attributeName string
29+
}
30+
31+
// NewGoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule returns new rule with default attributes
32+
func NewGoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule() *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule {
33+
return &GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule{
34+
resourceType: "google_scc_management_folder_security_health_analytics_custom_module",
35+
attributeName: "enablement_state",
36+
}
37+
}
38+
39+
// Name returns the rule name
40+
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Name() string {
41+
return "google_scc_management_folder_security_health_analytics_custom_module_invalid_enablement_state"
42+
}
43+
44+
// Enabled returns whether the rule is enabled by default
45+
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Enabled() bool {
46+
return true
47+
}
48+
49+
// Severity returns the rule severity
50+
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Severity() tflint.Severity {
51+
return tflint.ERROR
52+
}
53+
54+
// Link returns the rule reference link
55+
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) Link() string {
56+
return ""
57+
}
58+
59+
// Check checks the pattern is valid
60+
func (r *GoogleSccManagementFolderSecurityHealthAnalyticsCustomModuleInvalidEnablementStateRule) 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{"ENABLED", "DISABLED", ""}, 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+
}

0 commit comments

Comments
 (0)