From da13bf7ca0b199325cc86215e99f51eb6164da85 Mon Sep 17 00:00:00 2001 From: Kazuma Watanabe Date: Tue, 7 Dec 2021 01:53:49 +0900 Subject: [PATCH] Update Magic Modules (#136) --- ...gee_instance_invalid_peering_cidr_range.go | 73 ------------------- .../google_filestore_instance_invalid_tier.go | 73 ------------------- rules/magicmodules/product.go | 5 ++ rules/magicmodules/provider.go | 2 - tools/magic-modules | 2 +- 5 files changed, 6 insertions(+), 149 deletions(-) delete mode 100644 rules/magicmodules/google_apigee_instance_invalid_peering_cidr_range.go delete mode 100644 rules/magicmodules/google_filestore_instance_invalid_tier.go diff --git a/rules/magicmodules/google_apigee_instance_invalid_peering_cidr_range.go b/rules/magicmodules/google_apigee_instance_invalid_peering_cidr_range.go deleted file mode 100644 index 5df036e..0000000 --- a/rules/magicmodules/google_apigee_instance_invalid_peering_cidr_range.go +++ /dev/null @@ -1,73 +0,0 @@ -// ---------------------------------------------------------------------------- -// -// *** AUTO GENERATED CODE *** Type: MMv1 *** -// -// ---------------------------------------------------------------------------- -// -// This file is automatically generated by Magic Modules and manual -// changes will be clobbered when the file is regenerated. -// -// Please read more about how to change this file in -// .github/CONTRIBUTING.md. -// -// ---------------------------------------------------------------------------- - -package magicmodules - -import ( - hcl "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" -) - -// GoogleApigeeInstanceInvalidPeeringCidrRangeRule checks the pattern is valid -type GoogleApigeeInstanceInvalidPeeringCidrRangeRule struct { - resourceType string - attributeName string -} - -// NewGoogleApigeeInstanceInvalidPeeringCidrRangeRule returns new rule with default attributes -func NewGoogleApigeeInstanceInvalidPeeringCidrRangeRule() *GoogleApigeeInstanceInvalidPeeringCidrRangeRule { - return &GoogleApigeeInstanceInvalidPeeringCidrRangeRule{ - resourceType: "google_apigee_instance", - attributeName: "peering_cidr_range", - } -} - -// Name returns the rule name -func (r *GoogleApigeeInstanceInvalidPeeringCidrRangeRule) Name() string { - return "google_apigee_instance_invalid_peering_cidr_range" -} - -// Enabled returns whether the rule is enabled by default -func (r *GoogleApigeeInstanceInvalidPeeringCidrRangeRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *GoogleApigeeInstanceInvalidPeeringCidrRangeRule) Severity() string { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *GoogleApigeeInstanceInvalidPeeringCidrRangeRule) Link() string { - return "" -} - -// Check checks the pattern is valid -func (r *GoogleApigeeInstanceInvalidPeeringCidrRangeRule) Check(runner tflint.Runner) error { - return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { - var val string - err := runner.EvaluateExpr(attribute.Expr, &val, nil) - - validateFunc := validation.StringInSlice([]string{"SLASH_16", "SLASH_20", "SLASH_22", ""}, false) - - return runner.EnsureNoError(err, func() error { - _, errors := validateFunc(val, r.attributeName) - for _, err := range errors { - runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr) - } - return nil - }) - }) -} diff --git a/rules/magicmodules/google_filestore_instance_invalid_tier.go b/rules/magicmodules/google_filestore_instance_invalid_tier.go deleted file mode 100644 index a2b50a8..0000000 --- a/rules/magicmodules/google_filestore_instance_invalid_tier.go +++ /dev/null @@ -1,73 +0,0 @@ -// ---------------------------------------------------------------------------- -// -// *** AUTO GENERATED CODE *** Type: MMv1 *** -// -// ---------------------------------------------------------------------------- -// -// This file is automatically generated by Magic Modules and manual -// changes will be clobbered when the file is regenerated. -// -// Please read more about how to change this file in -// .github/CONTRIBUTING.md. -// -// ---------------------------------------------------------------------------- - -package magicmodules - -import ( - hcl "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - "github.com/terraform-linters/tflint-plugin-sdk/tflint" -) - -// GoogleFilestoreInstanceInvalidTierRule checks the pattern is valid -type GoogleFilestoreInstanceInvalidTierRule struct { - resourceType string - attributeName string -} - -// NewGoogleFilestoreInstanceInvalidTierRule returns new rule with default attributes -func NewGoogleFilestoreInstanceInvalidTierRule() *GoogleFilestoreInstanceInvalidTierRule { - return &GoogleFilestoreInstanceInvalidTierRule{ - resourceType: "google_filestore_instance", - attributeName: "tier", - } -} - -// Name returns the rule name -func (r *GoogleFilestoreInstanceInvalidTierRule) Name() string { - return "google_filestore_instance_invalid_tier" -} - -// Enabled returns whether the rule is enabled by default -func (r *GoogleFilestoreInstanceInvalidTierRule) Enabled() bool { - return true -} - -// Severity returns the rule severity -func (r *GoogleFilestoreInstanceInvalidTierRule) Severity() string { - return tflint.ERROR -} - -// Link returns the rule reference link -func (r *GoogleFilestoreInstanceInvalidTierRule) Link() string { - return "" -} - -// Check checks the pattern is valid -func (r *GoogleFilestoreInstanceInvalidTierRule) Check(runner tflint.Runner) error { - return runner.WalkResourceAttributes(r.resourceType, r.attributeName, func(attribute *hcl.Attribute) error { - var val string - err := runner.EvaluateExpr(attribute.Expr, &val, nil) - - validateFunc := validation.StringInSlice([]string{"TIER_UNSPECIFIED", "STANDARD", "PREMIUM", "BASIC_HDD", "BASIC_SSD", "HIGH_SCALE_SSD"}, false) - - return runner.EnsureNoError(err, func() error { - _, errors := validateFunc(val, r.attributeName) - for _, err := range errors { - runner.EmitIssueOnExpr(r, err.Error(), attribute.Expr) - } - return nil - }) - }) -} diff --git a/rules/magicmodules/product.go b/rules/magicmodules/product.go index 2c113cb..d42a858 100644 --- a/rules/magicmodules/product.go +++ b/rules/magicmodules/product.go @@ -949,6 +949,11 @@ var Products = map[string]Product{ {Name: "Cloud Notebooks API", URL: "https://console.cloud.google.com/apis/api/notebooks.googleapis.com"}, }, }, + "google_notebooks_runtime": { + APIsRequired: []APIReference{ + {Name: "Cloud Notebooks API", URL: "https://console.cloud.google.com/apis/api/notebooks.googleapis.com"}, + }, + }, "google_notebooks_location": { APIsRequired: []APIReference{ {Name: "Cloud Notebooks API", URL: "https://console.cloud.google.com/apis/api/notebooks.googleapis.com"}, diff --git a/rules/magicmodules/provider.go b/rules/magicmodules/provider.go index 0c498c3..246c05f 100644 --- a/rules/magicmodules/provider.go +++ b/rules/magicmodules/provider.go @@ -23,7 +23,6 @@ var Rules = []tflint.Rule{ NewGoogleAccessContextManagerServicePerimeterInvalidPerimeterTypeRule(), NewGoogleActiveDirectoryDomainTrustInvalidTrustDirectionRule(), NewGoogleActiveDirectoryDomainTrustInvalidTrustTypeRule(), - NewGoogleApigeeInstanceInvalidPeeringCidrRangeRule(), NewGoogleApigeeOrganizationInvalidRuntimeTypeRule(), NewGoogleAppEngineDomainMappingInvalidOverrideStrategyRule(), NewGoogleAppEngineFirewallRuleInvalidActionRule(), @@ -101,7 +100,6 @@ var Rules = []tflint.Rule{ NewGoogleDialogflowEntityTypeInvalidKindRule(), NewGoogleDialogflowIntentInvalidWebhookStateRule(), NewGoogleDnsManagedZoneInvalidVisibilityRule(), - NewGoogleFilestoreInstanceInvalidTierRule(), NewGoogleFirestoreIndexInvalidQueryScopeRule(), NewGoogleHealthcareFhirStoreInvalidVersionRule(), NewGoogleKmsCryptoKeyInvalidPurposeRule(), diff --git a/tools/magic-modules b/tools/magic-modules index 67a815d..bb85272 160000 --- a/tools/magic-modules +++ b/tools/magic-modules @@ -1 +1 @@ -Subproject commit 67a815d478313b16586348682afd89a38c56e4d8 +Subproject commit bb8527258136ea87c9673d257ffd5138cab82774