From d3730e3471165f74a01c815ca682bf55d87546f6 Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Wed, 6 Nov 2024 15:52:48 -0300 Subject: [PATCH 01/12] - Added new resource WasmPlugin and related tests; - Fixed NetworkServices product being configured to use v1 endpoints for the beta providers; --- mmv1/products/networkservices/WasmPlugin.yaml | 188 ++++++++++++++++++ mmv1/products/networkservices/product.yaml | 2 +- .../wasm_plugin_skip_empty_versions.go.tmpl | 72 +++++++ .../examples/wasm_plugin_basic.tf.tmpl | 30 +++ ..._network_services_wasm_plugin_test.go.tmpl | 178 +++++++++++++++++ 5 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 mmv1/products/networkservices/WasmPlugin.yaml create mode 100644 mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl create mode 100644 mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl create mode 100644 mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl diff --git a/mmv1/products/networkservices/WasmPlugin.yaml b/mmv1/products/networkservices/WasmPlugin.yaml new file mode 100644 index 000000000000..6f6e8a51df75 --- /dev/null +++ b/mmv1/products/networkservices/WasmPlugin.yaml @@ -0,0 +1,188 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +name: 'WasmPlugin' +description: | + WasmPlugin is a resource representing a service executing a customer-provided Wasm module. +min_version: 'beta' +references: + guides: + 'Configure a route extension': 'https://cloud.google.com/service-extensions/docs/create-plugin' + api: 'https://cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins' +docs: +base_url: 'projects/{{project}}/locations/{{location}}/wasmPlugins' +self_link: 'projects/{{project}}/locations/{{location}}/wasmPlugins/{{name}}' +create_url: 'projects/{{project}}/locations/{{location}}/wasmPlugins?wasmPluginId={{name}}' +create_verb: 'POST' +update_verb: 'PATCH' +update_mask: true +read_query_params: '?view=WASM_PLUGIN_VIEW_FULL' +timeouts: + insert_minutes: 20 + update_minutes: 20 + delete_minutes: 20 +async: + actions: ['create', 'delete', 'update'] + type: 'OpAsync' + operation: + base_url: '{{op_id}}' + result: + resource_inside_response: false +custom_code: +examples: + - name: 'wasm_plugin_basic' + primary_resource_id: 'wasm_plugin' + min_version: 'beta' + vars: + wasm_plugin_name: 'my-wasm-plugin' +parameters: + - name: 'location' + type: String + description: | + The location of the traffic extension + url_param_only: true + required: true + immutable: true + - name: 'name' + type: String + description: | + Identifier. Name of the WasmPlugin resource. + url_param_only: true + required: true + immutable: true +properties: + - name: 'createTime' + type: Time + description: 'Output only. The timestamp when the resource was created.' + output: true + - name: 'updateTime' + type: Time + description: 'Output only. The timestamp when the resource was updated.' + output: true + - name: 'description' + type: String + description: | + Optional. A human-readable description of the resource. + - name: 'labels' + type: KeyValueLabels + description: 'Optional. Set of labels associated with the WasmPlugin resource.' + - name: 'mainVersionId' + type: ResourceRef + resource: 'WasmPluginVersion' + description: | + Optional. The ID of the WasmPluginVersion resource that is the currently serving one. The version referred to must be a child of this WasmPlugin resource and should be listed in the "versions" field. + - name: 'logConfig' + type: NestedObject + description: | + Optional. Specifies the logging options for the activity performed by this plugin. If logging is enabled, plugin logs are exported to Cloud Logging. + Note that the settings relate to the logs generated by using logging statements in your Wasm code. + properties: + - name: 'enable' + type: Boolean + description: | + Optional. Specifies whether to enable logging for activity by this plugin. + - name: 'sampleRate' + type: Double + validation: + function: 'validation.FloatBetween(0, 1)' + description: | + Non-empty default. Configures the sampling rate of activity logs, where 1.0 means all logged activity is reported and 0.0 means no activity is reported. + A floating point value between 0.0 and 1.0 indicates that a percentage of log messages is stored. + The default value when logging is enabled is 1.0. The value of the field must be between 0 and 1 (inclusive). + This field can be specified only if logging is enabled for this plugin. + default_from_api: true + - name: 'minLogLevel' + type: Enum + description: | + Non-empty default. Specificies the lowest level of the plugin logs that are exported to Cloud Logging. This setting relates to the logs generated by using logging statements in your Wasm code. + This field is can be set only if logging is enabled for the plugin. + If the field is not provided when logging is enabled, it is set to INFO by default. + default_from_api: true + enum_values: + - 'LOG_LEVEL_UNSPECIFIED' + - 'TRACE' + - 'DEBUG' + - 'INFO' + - 'WARN' + - 'ERROR' + - 'CRITICAL' + - name: 'versions' + type: Map + description: | + Optional. All versions of this WasmPlugin resource in the key-value format. The key is the resource ID, and the value is the VersionDetails object. + key_name: 'version_name' + key_description: 'Name of the WasmPluginVersion' + custom_expand: 'templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl' + value_type: + name: value + type: NestedObject + properties: + - name: 'createTime' + type: Time + description: 'Output only. The timestamp when the resource was created.' + output: true + - name: 'updateTime' + type: Time + description: 'Output only. The timestamp when the resource was updated.' + output: true + - name: 'description' + type: String + description: | + Optional. A human-readable description of the resource. + - name: 'labels' + type: KeyValuePairs + description: 'Optional. Set of labels associated with the WasmPlugin resource.' + - name: 'imageUri' + type: String + description: | + Optional. URI of the container image containing the plugin, stored in the Artifact Registry. When a new WasmPluginVersion resource is created, the digest of the container image is saved in the imageDigest field. + When downloading an image, the digest value is used instead of an image tag. + - name: 'imageDigest' + type: String + description: | + Output only. The resolved digest for the image specified in the image field. The digest is resolved during the creation of WasmPluginVersion resource. + This field holds the digest value, regardless of whether a tag or digest was originally specified in the image field. + output: true + - name: 'pluginConfigDigest' + type: String + description: | + Output only. This field holds the digest (usually checksum) value for the plugin configuration. + The value is calculated based on the contents of pluginConfigData or the container image defined by the pluginConfigUri field. + output: true + - name: 'pluginConfigData' + type: String + description: | + A base64-encoded string containing the configuration for the plugin. The configuration is provided to the plugin at runtime through the ON_CONFIGURE callback. + When a new WasmPluginVersion resource is created, the digest of the contents is saved in the pluginConfigDigest field. + Conflics with pluginConfigUri. + conflicts: + - pluginConfigUri + - name: 'pluginConfigUri' + type: String + description: | + URI of the plugin configuration stored in the Artifact Registry. The configuration is provided to the plugin at runtime through the ON_CONFIGURE callback. + The container image must contain only a single file with the name plugin.config. + When a new WasmPluginVersion resource is created, the digest of the container image is saved in the pluginConfigDigest field. + Conflics with pluginConfigData. + conflicts: + - pluginConfigData + - name: 'usedBy' + type: Array + description: | + Output only. List of all extensions that use this WasmPlugin resource. + output: true + item_type: + name: 'name' + type: string + description: 'Output only. Full name of the resource' diff --git a/mmv1/products/networkservices/product.yaml b/mmv1/products/networkservices/product.yaml index f3bceafaf1ce..239faaf98933 100644 --- a/mmv1/products/networkservices/product.yaml +++ b/mmv1/products/networkservices/product.yaml @@ -16,7 +16,7 @@ name: 'NetworkServices' display_name: 'Network services' versions: - name: 'beta' - base_url: 'https://networkservices.googleapis.com/v1/' + base_url: 'https://networkservices.googleapis.com/v1beta1/' - name: 'ga' base_url: 'https://networkservices.googleapis.com/v1/' scopes: diff --git a/mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl b/mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl new file mode 100644 index 000000000000..ee14f23f3917 --- /dev/null +++ b/mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl @@ -0,0 +1,72 @@ +func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + if v == nil { + return map[string]interface{}{}, nil + } + m := make(map[string]interface{}) + for _, raw := range v.(*schema.Set).List() { + original := raw.(map[string]interface{}) + transformed := make(map[string]interface{}) + + // Ensure we don't send empty versions + if tpgresource.IsEmptyValue(reflect.ValueOf(original["version_name"])) { + continue + } + + transformedDescription, err := expandNetworkServicesWasmPluginVersionsFields(original["description"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedDescription); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["description"] = transformedDescription + } + + transformedLabels, err := expandNetworkServicesWasmPluginVersionsLabels(original["labels"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedLabels); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["labels"] = transformedLabels + } + + transformedImageUri, err := expandNetworkServicesWasmPluginVersionsFields(original["image_uri"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedImageUri); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["imageUri"] = transformedImageUri + } + + transformedPluginConfigData, err := expandNetworkServicesWasmPluginVersionsFields(original["plugin_config_data"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedPluginConfigData); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["pluginConfigData"] = transformedPluginConfigData + } + + transformedPluginConfigUri, err := expandNetworkServicesWasmPluginVersionsFields(original["plugin_config_uri"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedPluginConfigUri); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["pluginConfigUri"] = transformedPluginConfigUri + } + + transformedVersionName, err := tpgresource.ExpandString(original["version_name"], d, config) + if err != nil { + return nil, err + } + m[transformedVersionName] = transformed + } + return m, nil +} + +func expandNetworkServicesWasmPluginVersionsFields(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandNetworkServicesWasmPluginVersionsLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { + if v == nil { + return map[string]string{}, nil + } + m := make(map[string]string) + for k, val := range v.(map[string]interface{}) { + m[k] = val.(string) + } + return m, nil +} diff --git a/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl b/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl new file mode 100644 index 000000000000..09529f302f8c --- /dev/null +++ b/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl @@ -0,0 +1,30 @@ +data "google_project" "project" { provider = google-beta } + +resource "google_network_services_wasm_plugin" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "wasm_plugin_name"}}" + description = "my wasm plugin" + location = "global" + + main_version_id = "v1" + + labels = { + test_label = "test_value" + } + log_config { + enable = true + sample_rate = 1 + min_log_level = "WARN" + } + + versions { + version_name = "v1" + description = "v1 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/${data.google_project.project.name}/svextensionplugin/my-wasm-plugin:prod" + + labels = { + test_label = "test_value" + } + } + +} diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl new file mode 100644 index 000000000000..1de086ab4120 --- /dev/null +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl @@ -0,0 +1,178 @@ +package networkservices_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + "test_project_id" : envvar.GetTestProjectFromEnv(), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + CheckDestroy: testAccCheckNetworkServicesWasmPluginDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context), + }, + { + ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, + }, + { + Config: testAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(context), + }, + { + ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, + }, + }, + }) +} + +func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + "test_project_id" : envvar.GetTestProjectFromEnv(), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + CheckDestroy: testAccCheckNetworkServicesWasmPluginDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context), + }, + { + ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, + }, + { + Config: testAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(context), + }, + { + ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, + }, + }, + }) +} + +func testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_network_services_wasm_plugin" "wasm_plugin" { + provider = google-beta + name = "tf-test-my-wasm-plugin%{random_suffix}" + description = "my wasm plugin" + location = "global" + + main_version_id = "v1" + + labels = { + test_label = "test_value" + } + log_config { + enable = true + sample_rate = 1 + min_log_level = "WARN" + } + + versions { + version_name = "v1" + description = "v1 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + + labels = { + test_label = "test_value" + } + } + +} +`, context) +} + +func testAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_network_services_wasm_plugin" "wasm_plugin" { + provider = google-beta + name = "tf-test-my-wasm-plugin%{random_suffix}" + description = "my wasm plugin" + location = "global" + + main_version_id = "v1" + + labels = { + test_label2 = "test_value2" + } + log_config { + enable = true + sample_rate = 0.5 + min_log_level = "ERROR" + } + + versions { + version_name = "v1" + description = "v1 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + + labels = { + test_label = "test_value" + } + } + +} +`, context) +} + +func testAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_network_services_wasm_plugin" "wasm_plugin" { + provider = google-beta + name = "tf-test-my-wasm-plugin%{random_suffix}" + description = "my wasm plugin" + location = "global" + + main_version_id = "v2" + + labels = { + test_label = "test_value" + } + log_config { + enable = true + sample_rate = 1 + min_log_level = "WARN" + } + + versions { + version_name = "v2" + description = "v2 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + + labels = { + test_label = "test_value" + } + } + +} +`, context) +} From 6f53824c1d0a8e8c5932999efd4fc06763b850c7 Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Thu, 7 Nov 2024 11:00:30 -0300 Subject: [PATCH 02/12] - Lint fix; --- mmv1/products/networkservices/WasmPlugin.yaml | 3 ++- .../wasm_plugin_skip_empty_versions.go.tmpl | 2 +- .../resource_network_services_wasm_plugin_test.go.tmpl | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mmv1/products/networkservices/WasmPlugin.yaml b/mmv1/products/networkservices/WasmPlugin.yaml index 6f6e8a51df75..f8dd9269923d 100644 --- a/mmv1/products/networkservices/WasmPlugin.yaml +++ b/mmv1/products/networkservices/WasmPlugin.yaml @@ -19,7 +19,7 @@ min_version: 'beta' references: guides: 'Configure a route extension': 'https://cloud.google.com/service-extensions/docs/create-plugin' - api: 'https://cloud.google.com/service-extensions/docs/reference/rest/v1alpha1/projects.locations.wasmPlugins' + api: 'https://cloud.google.com/service-extensions/docs/reference/rest/v1beta1/projects.locations.wasmPlugins' docs: base_url: 'projects/{{project}}/locations/{{location}}/wasmPlugins' self_link: 'projects/{{project}}/locations/{{location}}/wasmPlugins/{{name}}' @@ -123,6 +123,7 @@ properties: Optional. All versions of this WasmPlugin resource in the key-value format. The key is the resource ID, and the value is the VersionDetails object. key_name: 'version_name' key_description: 'Name of the WasmPluginVersion' + # custom_expand is used for both preventing empty maps being created on update and to remove output fields that are being incorrecty included in the expand when inside a map custom_expand: 'templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl' value_type: name: value diff --git a/mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl b/mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl index ee14f23f3917..8030ba8d823f 100644 --- a/mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl +++ b/mmv1/templates/terraform/custom_expand/wasm_plugin_skip_empty_versions.go.tmpl @@ -1,5 +1,5 @@ func expand{{$.GetPrefix}}{{$.TitlelizeProperty}}(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - if v == nil { + if v == nil { return map[string]interface{}{}, nil } m := make(map[string]interface{}) diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl index 1de086ab4120..8b5a9ae7b454 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl @@ -9,11 +9,12 @@ import ( ) func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { + acctest.SkipIfVcr(t) // Test requires a existing container image that contains the plugin code, published in an Artifact Registry repository. t.Parallel() context := map[string]interface{}{ "random_suffix": acctest.RandString(t, 10), - "test_project_id" : envvar.GetTestProjectFromEnv(), + "test_project_id" : envvar.GetTestProjectFromEnv(), } acctest.VcrTest(t, resource.TestCase{ @@ -30,7 +31,7 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, - { + { Config: testAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(context), }, { @@ -48,7 +49,7 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { context := map[string]interface{}{ "random_suffix": acctest.RandString(t, 10), - "test_project_id" : envvar.GetTestProjectFromEnv(), + "test_project_id" : envvar.GetTestProjectFromEnv(), } acctest.VcrTest(t, resource.TestCase{ @@ -65,7 +66,7 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, - { + { Config: testAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(context), }, { From cc688beac5a712f032eb3eb169497d0e56dff3f0 Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Thu, 7 Nov 2024 17:34:00 -0300 Subject: [PATCH 03/12] - Lint fix; --- mmv1/products/networkservices/WasmPlugin.yaml | 98 +++++++++---------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/mmv1/products/networkservices/WasmPlugin.yaml b/mmv1/products/networkservices/WasmPlugin.yaml index f8dd9269923d..bbc835692b2a 100644 --- a/mmv1/products/networkservices/WasmPlugin.yaml +++ b/mmv1/products/networkservices/WasmPlugin.yaml @@ -129,55 +129,55 @@ properties: name: value type: NestedObject properties: - - name: 'createTime' - type: Time - description: 'Output only. The timestamp when the resource was created.' - output: true - - name: 'updateTime' - type: Time - description: 'Output only. The timestamp when the resource was updated.' - output: true - - name: 'description' - type: String - description: | - Optional. A human-readable description of the resource. - - name: 'labels' - type: KeyValuePairs - description: 'Optional. Set of labels associated with the WasmPlugin resource.' - - name: 'imageUri' - type: String - description: | - Optional. URI of the container image containing the plugin, stored in the Artifact Registry. When a new WasmPluginVersion resource is created, the digest of the container image is saved in the imageDigest field. - When downloading an image, the digest value is used instead of an image tag. - - name: 'imageDigest' - type: String - description: | - Output only. The resolved digest for the image specified in the image field. The digest is resolved during the creation of WasmPluginVersion resource. - This field holds the digest value, regardless of whether a tag or digest was originally specified in the image field. - output: true - - name: 'pluginConfigDigest' - type: String - description: | - Output only. This field holds the digest (usually checksum) value for the plugin configuration. - The value is calculated based on the contents of pluginConfigData or the container image defined by the pluginConfigUri field. - output: true - - name: 'pluginConfigData' - type: String - description: | - A base64-encoded string containing the configuration for the plugin. The configuration is provided to the plugin at runtime through the ON_CONFIGURE callback. - When a new WasmPluginVersion resource is created, the digest of the contents is saved in the pluginConfigDigest field. - Conflics with pluginConfigUri. - conflicts: - - pluginConfigUri - - name: 'pluginConfigUri' - type: String - description: | - URI of the plugin configuration stored in the Artifact Registry. The configuration is provided to the plugin at runtime through the ON_CONFIGURE callback. - The container image must contain only a single file with the name plugin.config. - When a new WasmPluginVersion resource is created, the digest of the container image is saved in the pluginConfigDigest field. - Conflics with pluginConfigData. - conflicts: - - pluginConfigData + - name: 'createTime' + type: Time + description: 'Output only. The timestamp when the resource was created.' + output: true + - name: 'updateTime' + type: Time + description: 'Output only. The timestamp when the resource was updated.' + output: true + - name: 'description' + type: String + description: | + Optional. A human-readable description of the resource. + - name: 'labels' + type: KeyValuePairs + description: 'Optional. Set of labels associated with the WasmPlugin resource.' + - name: 'imageUri' + type: String + description: | + Optional. URI of the container image containing the plugin, stored in the Artifact Registry. When a new WasmPluginVersion resource is created, the digest of the container image is saved in the imageDigest field. + When downloading an image, the digest value is used instead of an image tag. + - name: 'imageDigest' + type: String + description: | + Output only. The resolved digest for the image specified in the image field. The digest is resolved during the creation of WasmPluginVersion resource. + This field holds the digest value, regardless of whether a tag or digest was originally specified in the image field. + output: true + - name: 'pluginConfigDigest' + type: String + description: | + Output only. This field holds the digest (usually checksum) value for the plugin configuration. + The value is calculated based on the contents of pluginConfigData or the container image defined by the pluginConfigUri field. + output: true + - name: 'pluginConfigData' + type: String + description: | + A base64-encoded string containing the configuration for the plugin. The configuration is provided to the plugin at runtime through the ON_CONFIGURE callback. + When a new WasmPluginVersion resource is created, the digest of the contents is saved in the pluginConfigDigest field. + Conflics with pluginConfigUri. + conflicts: + - pluginConfigUri + - name: 'pluginConfigUri' + type: String + description: | + URI of the plugin configuration stored in the Artifact Registry. The configuration is provided to the plugin at runtime through the ON_CONFIGURE callback. + The container image must contain only a single file with the name plugin.config. + When a new WasmPluginVersion resource is created, the digest of the container image is saved in the pluginConfigDigest field. + Conflics with pluginConfigData. + conflicts: + - pluginConfigData - name: 'usedBy' type: Array description: | From cca20cfed98ae8b0e2f9676bd97a0ce2b706952d Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Fri, 8 Nov 2024 11:01:01 -0300 Subject: [PATCH 04/12] - Skipping test wasmPluginVersionUpdate; --- .../resource_network_services_wasm_plugin_test.go.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl index 8b5a9ae7b454..07db460c5469 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl @@ -45,6 +45,7 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { } func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { + acctest.SkipIfVcr(t) t.Parallel() context := map[string]interface{}{ From 450eee9ffbe6b6137bca46165434d6f114b10a04 Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Tue, 12 Nov 2024 19:09:00 -0300 Subject: [PATCH 05/12] - Added tests for plugin config fields; - Changed mainVersionId type to String; --- mmv1/products/networkservices/WasmPlugin.yaml | 9 +- ..._network_services_wasm_plugin_test.go.tmpl | 121 +++++++++++++++++- 2 files changed, 125 insertions(+), 5 deletions(-) diff --git a/mmv1/products/networkservices/WasmPlugin.yaml b/mmv1/products/networkservices/WasmPlugin.yaml index bbc835692b2a..3d5f645db06d 100644 --- a/mmv1/products/networkservices/WasmPlugin.yaml +++ b/mmv1/products/networkservices/WasmPlugin.yaml @@ -46,6 +46,7 @@ examples: min_version: 'beta' vars: wasm_plugin_name: 'my-wasm-plugin' + skip_vcr: true parameters: - name: 'location' type: String @@ -78,10 +79,10 @@ properties: type: KeyValueLabels description: 'Optional. Set of labels associated with the WasmPlugin resource.' - name: 'mainVersionId' - type: ResourceRef - resource: 'WasmPluginVersion' + type: String description: | - Optional. The ID of the WasmPluginVersion resource that is the currently serving one. The version referred to must be a child of this WasmPlugin resource and should be listed in the "versions" field. + The ID of the WasmPluginVersion resource that is the currently serving one. The version referred to must be a child of this WasmPlugin resource and should be listed in the "versions" field. + required: true - name: 'logConfig' type: NestedObject description: | @@ -169,6 +170,8 @@ properties: Conflics with pluginConfigUri. conflicts: - pluginConfigUri + validation: + function: 'verify.ValidateBase64String' - name: 'pluginConfigUri' type: String description: | diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl index 07db460c5469..4b31340a99e9 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl +++ b/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl @@ -4,8 +4,8 @@ import ( "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" ) func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { @@ -80,6 +80,51 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { }) } +func TestAccNetworkServicesWasmPlugin_wasmPluginConfigUpdate(t *testing.T) { + acctest.SkipIfVcr(t) + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + "test_project_id" : envvar.GetTestProjectFromEnv(), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + CheckDestroy: testAccCheckNetworkServicesWasmPluginDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context), + }, + { + ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, + }, + { + Config: testAccNetworkServicesWasmPlugin_wasmPluginConfigDataUpdate(context), + }, + { + ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels"}, + }, + { + Config: testAccNetworkServicesWasmPlugin_wasmPluginConfigUriUpdate(context), + }, + { + ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels"}, + }, + }, + }) +} + func testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_network_services_wasm_plugin" "wasm_plugin" { @@ -178,3 +223,75 @@ resource "google_network_services_wasm_plugin" "wasm_plugin" { } `, context) } + +func testAccNetworkServicesWasmPlugin_wasmPluginConfigDataUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_project" "project" { provider = google-beta } + +resource "google_network_services_wasm_plugin" "wasm_plugin" { + provider = google-beta + name = "tf-test-my-wasm-plugin%{random_suffix}" + description = "my wasm plugin" + location = "global" + + main_version_id = "v2" + + labels = { + test_label = "test_value" + } + log_config { + enable = true + sample_rate = 1 + min_log_level = "WARN" + } + + versions { + version_name = "v2" + description = "v2 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + plugin_config_data = base64encode("WasmPluginConfigDataTestValue%{random_suffix}") + + labels = { + test_label = "test_value" + } + } + +} +`, context) +} + +func testAccNetworkServicesWasmPlugin_wasmPluginConfigUriUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +data "google_project" "project" { provider = google-beta } + +resource "google_network_services_wasm_plugin" "wasm_plugin" { + provider = google-beta + name = "tf-test-my-wasm-plugin%{random_suffix}" + description = "my wasm plugin" + location = "global" + + main_version_id = "v3" + + labels = { + test_label = "test_value" + } + log_config { + enable = true + sample_rate = 1 + min_log_level = "WARN" + } + + versions { + version_name = "v3" + description = "v3 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + plugin_config_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/wasm-plugin-config-secret:prod" + + labels = { + test_label = "test_value" + } + } + +} +`, context) +} From 0542729df0bf6bf32ac94531430ca38d20e715db Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Tue, 12 Nov 2024 19:24:31 -0300 Subject: [PATCH 06/12] - Set versions field as required; --- mmv1/products/networkservices/WasmPlugin.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mmv1/products/networkservices/WasmPlugin.yaml b/mmv1/products/networkservices/WasmPlugin.yaml index 3d5f645db06d..921ffb2c4963 100644 --- a/mmv1/products/networkservices/WasmPlugin.yaml +++ b/mmv1/products/networkservices/WasmPlugin.yaml @@ -121,7 +121,8 @@ properties: - name: 'versions' type: Map description: | - Optional. All versions of this WasmPlugin resource in the key-value format. The key is the resource ID, and the value is the VersionDetails object. + All versions of this WasmPlugin resource in the key-value format. The key is the resource ID, and the value is the VersionDetails object. + required: true key_name: 'version_name' key_description: 'Name of the WasmPluginVersion' # custom_expand is used for both preventing empty maps being created on update and to remove output fields that are being incorrecty included in the expand when inside a map From c13969fa7cce8ffd00e4976cff12b9ecd9931657 Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Fri, 22 Nov 2024 10:51:00 -0300 Subject: [PATCH 07/12] - Moved WasmPlugin resource to new product networkservicesplugins; --- mmv1/products/networkservices/product.yaml | 2 +- .../WasmPlugin.yaml | 1 + .../networkservicesplugins/product.yaml | 23 +++++++ .../examples/wasm_plugin_basic.tf.tmpl | 2 +- ..._network_services_wasm_plugin_test.go.tmpl | 62 +++++++++---------- 5 files changed, 57 insertions(+), 33 deletions(-) rename mmv1/products/{networkservices => networkservicesplugins}/WasmPlugin.yaml (99%) create mode 100644 mmv1/products/networkservicesplugins/product.yaml rename mmv1/third_party/terraform/services/{networkservices => networkservicesplugins}/resource_network_services_wasm_plugin_test.go.tmpl (69%) diff --git a/mmv1/products/networkservices/product.yaml b/mmv1/products/networkservices/product.yaml index 239faaf98933..f3bceafaf1ce 100644 --- a/mmv1/products/networkservices/product.yaml +++ b/mmv1/products/networkservices/product.yaml @@ -16,7 +16,7 @@ name: 'NetworkServices' display_name: 'Network services' versions: - name: 'beta' - base_url: 'https://networkservices.googleapis.com/v1beta1/' + base_url: 'https://networkservices.googleapis.com/v1/' - name: 'ga' base_url: 'https://networkservices.googleapis.com/v1/' scopes: diff --git a/mmv1/products/networkservices/WasmPlugin.yaml b/mmv1/products/networkservicesplugins/WasmPlugin.yaml similarity index 99% rename from mmv1/products/networkservices/WasmPlugin.yaml rename to mmv1/products/networkservicesplugins/WasmPlugin.yaml index 921ffb2c4963..05b0c35c2c11 100644 --- a/mmv1/products/networkservices/WasmPlugin.yaml +++ b/mmv1/products/networkservicesplugins/WasmPlugin.yaml @@ -32,6 +32,7 @@ timeouts: insert_minutes: 20 update_minutes: 20 delete_minutes: 20 +autogen_async: true async: actions: ['create', 'delete', 'update'] type: 'OpAsync' diff --git a/mmv1/products/networkservicesplugins/product.yaml b/mmv1/products/networkservicesplugins/product.yaml new file mode 100644 index 000000000000..e846819d99b4 --- /dev/null +++ b/mmv1/products/networkservicesplugins/product.yaml @@ -0,0 +1,23 @@ +# Copyright 2024 Google Inc. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- +name: 'NetworkServicesPlugins' +display_name: 'Network services plugins' +versions: + - name: 'beta' + base_url: 'https://networkservices.googleapis.com/v1beta1/' + - name: 'ga' + base_url: 'https://networkservices.googleapis.com/v1/' +scopes: + - 'https://www.googleapis.com/auth/cloud-identity' diff --git a/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl b/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl index 09529f302f8c..a34288c9053e 100644 --- a/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl @@ -1,6 +1,6 @@ data "google_project" "project" { provider = google-beta } -resource "google_network_services_wasm_plugin" "{{$.PrimaryResourceId}}" { +resource "google_network_services_plugins_wasm_plugin" "{{$.PrimaryResourceId}}" { provider = google-beta name = "{{index $.Vars "wasm_plugin_name"}}" description = "my wasm plugin" diff --git a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl b/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl similarity index 69% rename from mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl rename to mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl index 4b31340a99e9..862f0940f0be 100644 --- a/mmv1/third_party/terraform/services/networkservices/resource_network_services_wasm_plugin_test.go.tmpl +++ b/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl @@ -1,4 +1,4 @@ -package networkservices_test +package networkservicesplugins_test import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-provider-google/google/envvar" ) -func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { +func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { acctest.SkipIfVcr(t) // Test requires a existing container image that contains the plugin code, published in an Artifact Registry repository. t.Parallel() @@ -20,22 +20,22 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckNetworkServicesWasmPluginDestroyProducer(t), + CheckDestroy: testAccCheckNetworkServicesPluginsWasmPluginDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context), }, { - ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(context), }, { - ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, @@ -44,7 +44,7 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { }) } -func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { +func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() @@ -56,22 +56,22 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckNetworkServicesWasmPluginDestroyProducer(t), + CheckDestroy: testAccCheckNetworkServicesPluginsWasmPluginDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context), }, { - ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(context), }, { - ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, @@ -80,7 +80,7 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { }) } -func TestAccNetworkServicesWasmPlugin_wasmPluginConfigUpdate(t *testing.T) { +func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() @@ -92,31 +92,31 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginConfigUpdate(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckNetworkServicesWasmPluginDestroyProducer(t), + CheckDestroy: testAccCheckNetworkServicesPluginsWasmPluginDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context), }, { - ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesWasmPlugin_wasmPluginConfigDataUpdate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigDataUpdate(context), }, { - ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesWasmPlugin_wasmPluginConfigUriUpdate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUriUpdate(context), }, { - ResourceName: "google_network_services_wasm_plugin.wasm_plugin", + ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels"}, @@ -125,9 +125,9 @@ func TestAccNetworkServicesWasmPlugin_wasmPluginConfigUpdate(t *testing.T) { }) } -func testAccNetworkServicesWasmPlugin_wasmPluginBasicCreate(context map[string]interface{}) string { +func testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_network_services_wasm_plugin" "wasm_plugin" { +resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -158,9 +158,9 @@ resource "google_network_services_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesWasmPlugin_wasmPluginLogConfigUpdate(context map[string]interface{}) string { +func testAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_network_services_wasm_plugin" "wasm_plugin" { +resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -191,9 +191,9 @@ resource "google_network_services_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesWasmPlugin_wasmPluginVersionUpdate(context map[string]interface{}) string { +func testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_network_services_wasm_plugin" "wasm_plugin" { +resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -224,11 +224,11 @@ resource "google_network_services_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesWasmPlugin_wasmPluginConfigDataUpdate(context map[string]interface{}) string { +func testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigDataUpdate(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { provider = google-beta } -resource "google_network_services_wasm_plugin" "wasm_plugin" { +resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -260,11 +260,11 @@ resource "google_network_services_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesWasmPlugin_wasmPluginConfigUriUpdate(context map[string]interface{}) string { +func testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUriUpdate(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { provider = google-beta } -resource "google_network_services_wasm_plugin" "wasm_plugin" { +resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" From 499938e3eaa8904ec7ec3b8378d46c15ca662686 Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Fri, 22 Nov 2024 11:01:56 -0300 Subject: [PATCH 08/12] - New resource config; --- .../terraform/.teamcity/components/inputs/services_beta.kt | 5 +++++ .../terraform/.teamcity/components/inputs/services_ga.kt | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt index b025568eac6d..82e9e47dd495 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt @@ -551,6 +551,11 @@ var ServicesListBeta = mapOf( "displayName" to "Networkservices", "path" to "./google-beta/services/networkservices" ), + "networkservicesplugins" to mapOf( + "name" to "networkservicesplugins", + "displayName" to "Networkservicesplugins", + "path" to "./google-beta/services/networkservicesplugins" + ), "notebooks" to mapOf( "name" to "notebooks", "displayName" to "Notebooks", diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt index 5087bad11881..1f4e20c7c9ed 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -546,6 +546,11 @@ var ServicesListGa = mapOf( "displayName" to "Networkservices", "path" to "./google/services/networkservices" ), + "networkservicesplugins" to mapOf( + "name" to "networkservicesplugins", + "displayName" to "Networkservicesplugins", + "path" to "./google/services/networkservicesplugins" + ), "notebooks" to mapOf( "name" to "notebooks", "displayName" to "Notebooks", From 31b542a1513e70dba50f18de67cb5eb0790649df Mon Sep 17 00:00:00 2001 From: Chris Hawk Date: Mon, 25 Nov 2024 12:47:55 -0800 Subject: [PATCH 09/12] Capitalize display name in product.yaml --- mmv1/products/networkservicesplugins/product.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/networkservicesplugins/product.yaml b/mmv1/products/networkservicesplugins/product.yaml index e846819d99b4..c182ba1b846b 100644 --- a/mmv1/products/networkservicesplugins/product.yaml +++ b/mmv1/products/networkservicesplugins/product.yaml @@ -13,7 +13,7 @@ --- name: 'NetworkServicesPlugins' -display_name: 'Network services plugins' +display_name: 'Network Services Plugins' versions: - name: 'beta' base_url: 'https://networkservices.googleapis.com/v1beta1/' From 6d0bf6507fbcc272dad2d0ca0198c178b18f5aa5 Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Tue, 26 Nov 2024 18:37:04 -0300 Subject: [PATCH 10/12] - Ajusted wasmPluginVersionCreate test to test multiple plugin versions; --- ..._network_services_wasm_plugin_test.go.tmpl | 54 ++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl b/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl index 862f0940f0be..fd87fc1c0529 100644 --- a/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl +++ b/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl @@ -59,7 +59,7 @@ func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(t *testing. CheckDestroy: testAccCheckNetworkServicesPluginsWasmPluginDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context), + Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionCreate(context), }, { ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", @@ -191,7 +191,7 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(context map[string]interface{}) string { +func testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionCreate(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { provider = google-beta @@ -210,6 +210,15 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { min_log_level = "WARN" } + versions { + version_name = "v1" + description = "v1 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + + labels = { + test_label = "test_value" + } + } versions { version_name = "v2" description = "v2 version of my wasm plugin" @@ -224,6 +233,47 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { `, context) } +func testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { + provider = google-beta + name = "tf-test-my-wasm-plugin%{random_suffix}" + description = "my wasm plugin" + location = "global" + + main_version_id = "v2" + + labels = { + test_label = "test_value" + } + log_config { + enable = true + sample_rate = 1 + min_log_level = "WARN" + } + + versions { + version_name = "v2" + description = "v2 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + + labels = { + test_label = "test_value" + } + } + versions { + version_name = "v3" + description = "v3 version of my wasm plugin" + image_uri = "us-central1-docker.pkg.dev/%{test_project_id}/svextensionplugin/my-wasm-plugin:prod" + + labels = { + test_label = "test_value" + } + } +} +`, context) +} + func testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigDataUpdate(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { provider = google-beta } From 64c4b7db82d890703e04cb0b001a23120c4c6ebd Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Wed, 4 Dec 2024 19:58:45 -0300 Subject: [PATCH 11/12] - Renamed NetworkServicesPlugins product to ServiceExtensions; --- .../WasmPlugin.yaml | 0 .../product.yaml | 4 +- .../examples/wasm_plugin_basic.tf.tmpl | 2 +- .../components/inputs/services_beta.kt | 8 +-- .../components/inputs/services_ga.kt | 8 +-- ...rvice_extensions_wasm_plugin_test.go.tmpl} | 66 +++++++++---------- 6 files changed, 44 insertions(+), 44 deletions(-) rename mmv1/products/{networkservicesplugins => serviceextensions}/WasmPlugin.yaml (100%) rename mmv1/products/{networkservicesplugins => serviceextensions}/product.yaml (91%) rename mmv1/third_party/terraform/services/{networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl => serviceextensions/resource_service_extensions_wasm_plugin_test.go.tmpl} (72%) diff --git a/mmv1/products/networkservicesplugins/WasmPlugin.yaml b/mmv1/products/serviceextensions/WasmPlugin.yaml similarity index 100% rename from mmv1/products/networkservicesplugins/WasmPlugin.yaml rename to mmv1/products/serviceextensions/WasmPlugin.yaml diff --git a/mmv1/products/networkservicesplugins/product.yaml b/mmv1/products/serviceextensions/product.yaml similarity index 91% rename from mmv1/products/networkservicesplugins/product.yaml rename to mmv1/products/serviceextensions/product.yaml index c182ba1b846b..6ee96d34d0c4 100644 --- a/mmv1/products/networkservicesplugins/product.yaml +++ b/mmv1/products/serviceextensions/product.yaml @@ -12,8 +12,8 @@ # limitations under the License. --- -name: 'NetworkServicesPlugins' -display_name: 'Network Services Plugins' +name: 'ServiceExtensions' +display_name: 'Network Services Service Extensions' versions: - name: 'beta' base_url: 'https://networkservices.googleapis.com/v1beta1/' diff --git a/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl b/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl index a34288c9053e..88b857794bc0 100644 --- a/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/wasm_plugin_basic.tf.tmpl @@ -1,6 +1,6 @@ data "google_project" "project" { provider = google-beta } -resource "google_network_services_plugins_wasm_plugin" "{{$.PrimaryResourceId}}" { +resource "google_service_extensions_wasm_plugin" "{{$.PrimaryResourceId}}" { provider = google-beta name = "{{index $.Vars "wasm_plugin_name"}}" description = "my wasm plugin" diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt index 8fe48fe0351a..ed6fd23e76dc 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt @@ -556,10 +556,10 @@ var ServicesListBeta = mapOf( "displayName" to "Networkservices", "path" to "./google-beta/services/networkservices" ), - "networkservicesplugins" to mapOf( - "name" to "networkservicesplugins", - "displayName" to "Networkservicesplugins", - "path" to "./google-beta/services/networkservicesplugins" + "serviceextensions" to mapOf( + "name" to "serviceextensions", + "displayName" to "Serviceextensions", + "path" to "./google-beta/services/serviceextensions" ), "notebooks" to mapOf( "name" to "notebooks", diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt index cdd48f552ddf..5a8b3afcb467 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -551,10 +551,10 @@ var ServicesListGa = mapOf( "displayName" to "Networkservices", "path" to "./google/services/networkservices" ), - "networkservicesplugins" to mapOf( - "name" to "networkservicesplugins", - "displayName" to "Networkservicesplugins", - "path" to "./google/services/networkservicesplugins" + "serviceextensions" to mapOf( + "name" to "serviceextensions", + "displayName" to "Serviceextensions", + "path" to "./google/services/serviceextensions" ), "notebooks" to mapOf( "name" to "notebooks", diff --git a/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl b/mmv1/third_party/terraform/services/serviceextensions/resource_service_extensions_wasm_plugin_test.go.tmpl similarity index 72% rename from mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl rename to mmv1/third_party/terraform/services/serviceextensions/resource_service_extensions_wasm_plugin_test.go.tmpl index fd87fc1c0529..c26fd0858dbb 100644 --- a/mmv1/third_party/terraform/services/networkservicesplugins/resource_network_services_wasm_plugin_test.go.tmpl +++ b/mmv1/third_party/terraform/services/serviceextensions/resource_service_extensions_wasm_plugin_test.go.tmpl @@ -1,4 +1,4 @@ -package networkservicesplugins_test +package serviceextensions_test import ( "testing" @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-provider-google/google/envvar" ) -func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { +func TestAccServiceExtensionsWasmPlugin_wasmPluginLogConfigUpdate(t *testing.T) { acctest.SkipIfVcr(t) // Test requires a existing container image that contains the plugin code, published in an Artifact Registry repository. t.Parallel() @@ -20,22 +20,22 @@ func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(t *testin acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckNetworkServicesPluginsWasmPluginDestroyProducer(t), + CheckDestroy: testAccCheckServiceExtensionsWasmPluginDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context), + Config: testAccServiceExtensionsWasmPlugin_wasmPluginBasicCreate(context), }, { - ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", + ResourceName: "google_service_extensions_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(context), + Config: testAccServiceExtensionsWasmPlugin_wasmPluginLogConfigUpdate(context), }, { - ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", + ResourceName: "google_service_extensions_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, @@ -44,7 +44,7 @@ func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(t *testin }) } -func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { +func TestAccServiceExtensionsWasmPlugin_wasmPluginVersionUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() @@ -56,22 +56,22 @@ func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(t *testing. acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckNetworkServicesPluginsWasmPluginDestroyProducer(t), + CheckDestroy: testAccCheckServiceExtensionsWasmPluginDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionCreate(context), + Config: testAccServiceExtensionsWasmPlugin_wasmPluginVersionCreate(context), }, { - ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", + ResourceName: "google_service_extensions_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(context), + Config: testAccServiceExtensionsWasmPlugin_wasmPluginVersionUpdate(context), }, { - ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", + ResourceName: "google_service_extensions_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, @@ -80,7 +80,7 @@ func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(t *testing. }) } -func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUpdate(t *testing.T) { +func TestAccServiceExtensionsWasmPlugin_wasmPluginConfigUpdate(t *testing.T) { acctest.SkipIfVcr(t) t.Parallel() @@ -92,31 +92,31 @@ func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUpdate(t *testing.T acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), - CheckDestroy: testAccCheckNetworkServicesPluginsWasmPluginDestroyProducer(t), + CheckDestroy: testAccCheckServiceExtensionsWasmPluginDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context), + Config: testAccServiceExtensionsWasmPlugin_wasmPluginBasicCreate(context), }, { - ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", + ResourceName: "google_service_extensions_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "main_version_id", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigDataUpdate(context), + Config: testAccServiceExtensionsWasmPlugin_wasmPluginConfigDataUpdate(context), }, { - ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", + ResourceName: "google_service_extensions_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels"}, }, { - Config: testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUriUpdate(context), + Config: testAccServiceExtensionsWasmPlugin_wasmPluginConfigUriUpdate(context), }, { - ResourceName: "google_network_services_plugins_wasm_plugin.wasm_plugin", + ResourceName: "google_service_extensions_wasm_plugin.wasm_plugin", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"labels", "location", "name", "terraform_labels"}, @@ -125,9 +125,9 @@ func TestAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUpdate(t *testing.T }) } -func testAccNetworkServicesPluginsWasmPlugin_wasmPluginBasicCreate(context map[string]interface{}) string { +func testAccServiceExtensionsWasmPlugin_wasmPluginBasicCreate(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { +resource "google_service_extensions_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -158,9 +158,9 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesPluginsWasmPlugin_wasmPluginLogConfigUpdate(context map[string]interface{}) string { +func testAccServiceExtensionsWasmPlugin_wasmPluginLogConfigUpdate(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { +resource "google_service_extensions_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -191,9 +191,9 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionCreate(context map[string]interface{}) string { +func testAccServiceExtensionsWasmPlugin_wasmPluginVersionCreate(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { +resource "google_service_extensions_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -233,9 +233,9 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesPluginsWasmPlugin_wasmPluginVersionUpdate(context map[string]interface{}) string { +func testAccServiceExtensionsWasmPlugin_wasmPluginVersionUpdate(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { +resource "google_service_extensions_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -274,11 +274,11 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigDataUpdate(context map[string]interface{}) string { +func testAccServiceExtensionsWasmPlugin_wasmPluginConfigDataUpdate(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { provider = google-beta } -resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { +resource "google_service_extensions_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" @@ -310,11 +310,11 @@ resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { `, context) } -func testAccNetworkServicesPluginsWasmPlugin_wasmPluginConfigUriUpdate(context map[string]interface{}) string { +func testAccServiceExtensionsWasmPlugin_wasmPluginConfigUriUpdate(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { provider = google-beta } -resource "google_network_services_plugins_wasm_plugin" "wasm_plugin" { +resource "google_service_extensions_wasm_plugin" "wasm_plugin" { provider = google-beta name = "tf-test-my-wasm-plugin%{random_suffix}" description = "my wasm plugin" From 9bccad891ceddfbad9b94b96c43540bbe2d00cae Mon Sep 17 00:00:00 2001 From: Matheus Guilherme Souza Aleixo Date: Tue, 10 Dec 2024 13:54:42 -0300 Subject: [PATCH 12/12] - Temporarily removed serviceextensions from services_ga while wasm_plugins is in beta; --- .../terraform/.teamcity/components/inputs/services_ga.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt index 5a8b3afcb467..817c79f96f11 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -551,11 +551,6 @@ var ServicesListGa = mapOf( "displayName" to "Networkservices", "path" to "./google/services/networkservices" ), - "serviceextensions" to mapOf( - "name" to "serviceextensions", - "displayName" to "Serviceextensions", - "path" to "./google/services/serviceextensions" - ), "notebooks" to mapOf( "name" to "notebooks", "displayName" to "Notebooks",