From bc6c32174e7537d70a26afd90f40b5c275bd5373 Mon Sep 17 00:00:00 2001 From: wata727 <9624059+wata727@users.noreply.github.com> Date: Mon, 15 Sep 2025 01:51:55 +0000 Subject: [PATCH] Update Magic Modules --- rules/magicmodules/api_definition.go | 6 +- ...le_netapp_storage_pool_invalid_qos_type.go | 91 +++++++++++++++++++ ...k_services_gateway_invalid_routing_mode.go | 2 +- ...extension_invalid_load_balancing_scheme.go | 2 +- .../google_tags_tag_key_invalid_purpose.go | 2 +- rules/magicmodules/provider.go | 1 + rules/magicmodules/verify/validation.go | 2 +- tools/magic-modules | 2 +- 8 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 rules/magicmodules/google_netapp_storage_pool_invalid_qos_type.go diff --git a/rules/magicmodules/api_definition.go b/rules/magicmodules/api_definition.go index b0ec11d..5207ca3 100644 --- a/rules/magicmodules/api_definition.go +++ b/rules/magicmodules/api_definition.go @@ -87,7 +87,6 @@ var APIDefinition = map[string]string{ "google_beyondcorp_app_connection": "beyondcorp.googleapis.com", "google_beyondcorp_app_connector": "beyondcorp.googleapis.com", "google_beyondcorp_app_gateway": "beyondcorp.googleapis.com", - "google_beyondcorp_application": "beyondcorp.googleapis.com", "google_beyondcorp_security_gateway": "beyondcorp.googleapis.com", "google_beyondcorp_security_gateway_application": "beyondcorp.googleapis.com", "google_biglake_catalog": "biglake.googleapis.com", @@ -101,6 +100,7 @@ var APIDefinition = map[string]string{ "google_bigquery_connection": "bigqueryconnection.googleapis.com", "google_bigquery_data_transfer_config": "bigquerydatatransfer.googleapis.com", "google_bigquery_datapolicy_data_policy": "bigquerydatapolicy.googleapis.com", + "google_bigquery_datapolicyv2_data_policy": "bigquerydatapolicy.googleapis.com", "google_bigquery_dataset": "bigquery.googleapis.com", "google_bigquery_dataset_access": "bigquery.googleapis.com", "google_bigquery_job": "bigquery.googleapis.com", @@ -288,6 +288,7 @@ var APIDefinition = map[string]string{ "google_developer_connect_git_repository_link": "developerconnect.googleapis.com", "google_developer_connect_insights_config": "developerconnect.googleapis.com", "google_dialogflow_agent": "dialogflow.googleapis.com", + "google_dialogflow_conversation_profile": "dialogflow.googleapis.com", "google_dialogflow_encryption_spec": "dialogflow.googleapis.com", "google_dialogflow_entity_type": "dialogflow.googleapis.com", "google_dialogflow_fulfillment": "dialogflow.googleapis.com", @@ -491,7 +492,6 @@ var APIDefinition = map[string]string{ "google_network_services_tls_route": "networkservices.googleapis.com", "google_notebooks_environment": "notebooks.googleapis.com", "google_notebooks_instance": "notebooks.googleapis.com", - "google_notebooks_location": "notebooks.googleapis.com", "google_notebooks_runtime": "notebooks.googleapis.com", "google_oracle_database_autonomous_database": "oracledatabase.googleapis.com", "google_oracle_database_cloud_exadata_infrastructure": "oracledatabase.googleapis.com", @@ -553,6 +553,7 @@ var APIDefinition = map[string]string{ "google_secret_manager_secret": "secretmanager.googleapis.com", "google_secret_manager_secret_version": "secretmanager.googleapis.com", "google_secure_source_manager_branch_rule": "securesourcemanager.googleapis.com", + "google_secure_source_manager_hook": "securesourcemanager.googleapis.com", "google_secure_source_manager_instance": "securesourcemanager.googleapis.com", "google_secure_source_manager_repository": "securesourcemanager.googleapis.com", "google_securityposture_posture": "securityposture.googleapis.com", @@ -584,7 +585,6 @@ var APIDefinition = map[string]string{ "google_tags_tag_binding": "cloudresourcemanager.googleapis.com", "google_tags_tag_key": "cloudresourcemanager.googleapis.com", "google_tags_tag_value": "cloudresourcemanager.googleapis.com", - "google_tpu_node": "tpu.googleapis.com", "google_transcoder_job": "transcoder.googleapis.com", "google_transcoder_job_template": "transcoder.googleapis.com", "google_vmwareengine_cluster": "vmwareengine.googleapis.com", diff --git a/rules/magicmodules/google_netapp_storage_pool_invalid_qos_type.go b/rules/magicmodules/google_netapp_storage_pool_invalid_qos_type.go new file mode 100644 index 0000000..c1b1dbf --- /dev/null +++ b/rules/magicmodules/google_netapp_storage_pool_invalid_qos_type.go @@ -0,0 +1,91 @@ +// ---------------------------------------------------------------------------- +// +// *** 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 ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/tflint" +) + +// GoogleNetappStoragePoolInvalidQosTypeRule checks the pattern is valid +type GoogleNetappStoragePoolInvalidQosTypeRule struct { + tflint.DefaultRule + + resourceType string + attributeName string +} + +// NewGoogleNetappStoragePoolInvalidQosTypeRule returns new rule with default attributes +func NewGoogleNetappStoragePoolInvalidQosTypeRule() *GoogleNetappStoragePoolInvalidQosTypeRule { + return &GoogleNetappStoragePoolInvalidQosTypeRule{ + resourceType: "google_netapp_storage_pool", + attributeName: "qos_type", + } +} + +// Name returns the rule name +func (r *GoogleNetappStoragePoolInvalidQosTypeRule) Name() string { + return "google_netapp_storage_pool_invalid_qos_type" +} + +// Enabled returns whether the rule is enabled by default +func (r *GoogleNetappStoragePoolInvalidQosTypeRule) Enabled() bool { + return true +} + +// Severity returns the rule severity +func (r *GoogleNetappStoragePoolInvalidQosTypeRule) Severity() tflint.Severity { + return tflint.ERROR +} + +// Link returns the rule reference link +func (r *GoogleNetappStoragePoolInvalidQosTypeRule) Link() string { + return "" +} + +// Check checks the pattern is valid +func (r *GoogleNetappStoragePoolInvalidQosTypeRule) Check(runner tflint.Runner) error { + resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ + Attributes: []hclext.AttributeSchema{{Name: r.attributeName}}, + }, nil) + if err != nil { + return err + } + + for _, resource := range resources.Blocks { + attribute, exists := resource.Body.Attributes[r.attributeName] + if !exists { + continue + } + + err := runner.EvaluateExpr(attribute.Expr, func(val string) error { + validateFunc := validation.StringInSlice([]string{"QOS_TYPE_UNSPECIFIED", "AUTO", "MANUAL", ""}, false) + + _, errors := validateFunc(val, r.attributeName) + for _, err := range errors { + if err := runner.EmitIssue(r, err.Error(), attribute.Expr.Range()); err != nil { + return err + } + } + return nil + }, nil) + if err != nil { + return err + } + } + + return nil +} diff --git a/rules/magicmodules/google_network_services_gateway_invalid_routing_mode.go b/rules/magicmodules/google_network_services_gateway_invalid_routing_mode.go index 933ef1a..c3cdd44 100644 --- a/rules/magicmodules/google_network_services_gateway_invalid_routing_mode.go +++ b/rules/magicmodules/google_network_services_gateway_invalid_routing_mode.go @@ -72,7 +72,7 @@ func (r *GoogleNetworkServicesGatewayInvalidRoutingModeRule) Check(runner tflint } err := runner.EvaluateExpr(attribute.Expr, func(val string) error { - validateFunc := validation.StringInSlice([]string{"NEXT_HOP_ROUTING_MODE", ""}, false) + validateFunc := validation.StringInSlice([]string{"NEXT_HOP_ROUTING_MODE", "EXPLICIT_ROUTING_MODE", ""}, false) _, errors := validateFunc(val, r.attributeName) for _, err := range errors { diff --git a/rules/magicmodules/google_network_services_lb_traffic_extension_invalid_load_balancing_scheme.go b/rules/magicmodules/google_network_services_lb_traffic_extension_invalid_load_balancing_scheme.go index e9f0534..172b589 100644 --- a/rules/magicmodules/google_network_services_lb_traffic_extension_invalid_load_balancing_scheme.go +++ b/rules/magicmodules/google_network_services_lb_traffic_extension_invalid_load_balancing_scheme.go @@ -72,7 +72,7 @@ func (r *GoogleNetworkServicesLbTrafficExtensionInvalidLoadBalancingSchemeRule) } err := runner.EvaluateExpr(attribute.Expr, func(val string) error { - validateFunc := validation.StringInSlice([]string{"INTERNAL_MANAGED", "EXTERNAL_MANAGED", ""}, false) + validateFunc := validation.StringInSlice([]string{"INTERNAL_MANAGED", "EXTERNAL_MANAGED"}, false) _, errors := validateFunc(val, r.attributeName) for _, err := range errors { diff --git a/rules/magicmodules/google_tags_tag_key_invalid_purpose.go b/rules/magicmodules/google_tags_tag_key_invalid_purpose.go index 6643a2d..5e832fb 100644 --- a/rules/magicmodules/google_tags_tag_key_invalid_purpose.go +++ b/rules/magicmodules/google_tags_tag_key_invalid_purpose.go @@ -72,7 +72,7 @@ func (r *GoogleTagsTagKeyInvalidPurposeRule) Check(runner tflint.Runner) error { } err := runner.EvaluateExpr(attribute.Expr, func(val string) error { - validateFunc := validation.StringInSlice([]string{"GCE_FIREWALL", ""}, false) + validateFunc := validation.StringInSlice([]string{"GCE_FIREWALL", "DATA_GOVERNANCE", ""}, false) _, errors := validateFunc(val, r.attributeName) for _, err := range errors { diff --git a/rules/magicmodules/provider.go b/rules/magicmodules/provider.go index d2b237d..5e6e8ed 100644 --- a/rules/magicmodules/provider.go +++ b/rules/magicmodules/provider.go @@ -241,6 +241,7 @@ var Rules = []tflint.Rule{ NewGoogleMonitoringSloInvalidSloIdRule(), NewGoogleMonitoringUptimeCheckConfigInvalidCheckerTypeRule(), NewGoogleNetappBackupVaultInvalidBackupVaultTypeRule(), + NewGoogleNetappStoragePoolInvalidQosTypeRule(), NewGoogleNetappStoragePoolInvalidServiceLevelRule(), NewGoogleNetappVolumeInvalidSecurityStyleRule(), NewGoogleNetappVolumeQuotaRuleInvalidTypeRule(), diff --git a/rules/magicmodules/verify/validation.go b/rules/magicmodules/verify/validation.go index 9b9908d..49b32e1 100644 --- a/rules/magicmodules/verify/validation.go +++ b/rules/magicmodules/verify/validation.go @@ -304,7 +304,7 @@ func ValidateBase64String(i interface{}, val string) ([]string, []error) { } func ValidateBase64URLString(i interface{}, val string) ([]string, []error) { - _, err := base64.URLEncoding.DecodeString(i.(string)) + _, err := base64.RawURLEncoding.DecodeString(i.(string)) if err != nil { return nil, []error{fmt.Errorf("could not decode %q as a valid base64URL value.", val)} } diff --git a/tools/magic-modules b/tools/magic-modules index 24243ef..e0dd7ef 160000 --- a/tools/magic-modules +++ b/tools/magic-modules @@ -1 +1 @@ -Subproject commit 24243effdfb2796400e643f4006701640066d061 +Subproject commit e0dd7ef9ce1c5dab4540c574b845046ab2206dd5