From f225c950be62d3c531638947e657756c12bc4d4b Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 05:41:58 +0000 Subject: [PATCH 01/72] terraform glossary implementation --- mmv1/products/dataplex/Glossary.yaml | 130 ++++++++++++++++++ .../examples/dataplex_glossary_basic.tf.erb | 5 + .../examples/dataplex_glossary_full.tf.erb | 9 ++ .../resource_dataplex_glossary_test.go | 68 +++++++++ 4 files changed, 212 insertions(+) create mode 100644 mmv1/products/dataplex/Glossary.yaml create mode 100644 mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.erb create mode 100644 mmv1/templates/terraform/examples/dataplex_glossary_full.tf.erb create mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml new file mode 100644 index 000000000000..baa1d6006aa7 --- /dev/null +++ b/mmv1/products/dataplex/Glossary.yaml @@ -0,0 +1,130 @@ +# 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: 'Glossary' +description: | + Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. +docs: +base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' +self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' +create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossary_id={{glossary_id}}' +update_verb: 'PATCH' +update_mask: true +timeouts: + insert_minutes: 5 + update_minutes: 5 + delete_minutes: 5 +autogen_async: true +async: + actions: ['create', 'delete', 'update'] + type: 'OpAsync' + operation: + base_url: '{{op_id}}' +iam_policy: + method_name_separator: ':' + parent_resource_attribute: 'glossary_id' + example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' + import_format: + - 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary-id}}' + - '{{glossary-id}}' +custom_code: +examples: + - name: 'dataplex_glossary_basic' + primary_resource_id: 'glossary_test_id' + primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + vars: + glossary_name: 'glossary-basic' + test_env_vars: + project_name: 'PROJECT_NAME' + - name: 'dataplex_glossary_full' + primary_resource_id: 'glossary_test_id_full' + primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + vars: + glossary_name: 'glossary-full' + test_env_vars: + project_name: 'PROJECT_NAME' +parameters: + - name: 'location' + type: String + description: | + The location where the glossary should reside. + url_param_only: true + required: true + immutable: true + - name: 'glossaryId' + type: String + description: | + The glossary id for creation. + url_param_only: true + immutable: true +properties: + - name: 'name' + type: String + description: | + The resource name of the Glossary. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} + output: true + - name: 'location' + type: String + description: | + The location for the glossary. + required: true + - name: 'glossaryId' + type: String + description: | + User specified ID of the glossary. + required: true + - name: 'displayName' + type: String + description: | + User friendly display name of the glossary. This is user-mutable. This will be same as the glossaryId, if not specified. + optional: true + - name: 'description' + type: String + description: | + The user-mutable description of the glossary. + optional: true + - name: 'labels' + type: Map(String) + description: | + User-defined labels for the Glossary. + optional: true + - name: 'etag' + type: String + description: | + Needed for resource freshness validation. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. + optional: true + - name: 'uid' + type: String + description: | + System generated unique id for the Glossary. This ID will be different if the Glossary is deleted and re-created with the same name. + output: true + - name: 'createTime' + type: Timestamp + description: | + The time at which the glossary was created. + output: true + - name: 'updateTime' + type: Timestamp + description: | + The time at which the glossary was last updated. + output: true + - name: 'termCount' + type: Integer + description: | + The number of terms in the glossary. + optional: true + - name: 'categoryCount' + type: Integer + description: | + The number of categories in the glossary. + optional: true diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.erb b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.erb new file mode 100644 index 000000000000..ccb406ab2971 --- /dev/null +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.erb @@ -0,0 +1,5 @@ +resource "google_dataplex_glossary" "<%= ctx[:primary_resource_id] %>" { + glossary_id = "<%= ctx[:vars]['glossary_name'] %>" + project = "<%= ctx[:test_env_vars]['project_name'] %>" + location = "us-central1" +} diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.erb b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.erb new file mode 100644 index 000000000000..a4c5f75854a2 --- /dev/null +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.erb @@ -0,0 +1,9 @@ +resource "google_dataplex_glossary" "<%= ctx[:primary_resource_id] %>" { + glossary_id = "<%= ctx[:vars]['glossary_name'] %>" + project = "<%= ctx[:test_env_vars]['project_name'] %>" + location = "us-central1" + + labels = { "tag": "test-tf" } + display_name = "terraform glossary" + description = "glossary created by Terraform" +} diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go new file mode 100644 index 000000000000..04b5cc3eb5e0 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -0,0 +1,68 @@ +package dataplex_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 TestAccDataplexGlossary_update(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_name": envvar.GetTestProjectFromEnv(), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossary_full(context), + }, + { + ResourceName: "google_dataplex_glossary.test_glossary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"location", "glossary_id", "labels", "terraform_labels"}, + }, + { + Config: testAccDataplexGlossary_update(context), + }, + { + ResourceName: "google_dataplex_glossary.test_glossary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"location", "glossary_id", "labels", "terraform_labels"}, + }, + } + }) +} + +func testAccDataplexGlossary_full(context map[string]interface{}) string { + return acctest.Nprintf(` + resource "google_dataplex_glossary" "test_glossary" { + glossary_id = "tf-test-glossary%{random_suffix}" + project = "%{project_name}" + location = "us-central1" +} +`, context) +} + +func testAccDataplexGlossary_update(context map[string]interface{}) string { + return acctest.Nprintf(` + resource "google_dataplex_glossary" "test_glossary" { + glossary_id = "tf-test-glossary%{random_suffix}" + project = "%{project_name}" + location = "us-central1" + + labels = {"tag": "test-tf"} + display_name = "terraform glossary" + description = "glossary created by Terraform" +} +`, context) +} From 79adfe9d6a2810564acc1a4c25131c4f141db3e2 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 05:51:12 +0000 Subject: [PATCH 02/72] fix-lint --- .../resource_dataplex_glossary_test.go | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 04b5cc3eb5e0..0a1bc7923c1c 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -2,6 +2,7 @@ package dataplex_test import ( "testing" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-provider-google/google/acctest" @@ -10,36 +11,36 @@ import ( func TestAccDataplexGlossary_update(t *testing.T) { t.Parallel() - + context := map[string]interface{}{ - "project_name": envvar.GetTestProjectFromEnv(), + "project_name": envvar.GetTestProjectFromEnv(), "random_suffix": acctest.RandString(t, 10), } acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, + PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), + CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), Steps: []resource.TestStep{ { Config: testAccDataplexGlossary_full(context), }, { - ResourceName: "google_dataplex_glossary.test_glossary", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_dataplex_glossary.test_glossary", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"location", "glossary_id", "labels", "terraform_labels"}, }, { Config: testAccDataplexGlossary_update(context), }, { - ResourceName: "google_dataplex_glossary.test_glossary", - ImportState: true, - ImportStateVerify: true, + ResourceName: "google_dataplex_glossary.test_glossary", + ImportState: true, + ImportStateVerify: true, ImportStateVerifyIgnore: []string{"location", "glossary_id", "labels", "terraform_labels"}, }, - } + }, }) } From 4971e145697a28bea066fdd9528369a1543dd5f0 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 07:01:38 +0000 Subject: [PATCH 03/72] update file name --- ...plex_glossary_basic.tf.erb => dataplex_glossary_basic.tf.tmpl} | 0 ...taplex_glossary_full.tf.erb => dataplex_glossary_full.tf.tmpl} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename mmv1/templates/terraform/examples/{dataplex_glossary_basic.tf.erb => dataplex_glossary_basic.tf.tmpl} (100%) rename mmv1/templates/terraform/examples/{dataplex_glossary_full.tf.erb => dataplex_glossary_full.tf.tmpl} (100%) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.erb b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.erb rename to mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.erb b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl similarity index 100% rename from mmv1/templates/terraform/examples/dataplex_glossary_full.tf.erb rename to mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl From 6f704e1cc23e3fc659730fc5e0fe6f8dbf88e88e Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 07:09:43 +0000 Subject: [PATCH 04/72] update optional to required --- mmv1/products/dataplex/Glossary.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index baa1d6006aa7..cbc05160a0a5 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -82,27 +82,27 @@ properties: type: String description: | User specified ID of the glossary. - required: true + required: false - name: 'displayName' type: String description: | User friendly display name of the glossary. This is user-mutable. This will be same as the glossaryId, if not specified. - optional: true + required: false - name: 'description' type: String description: | The user-mutable description of the glossary. - optional: true + required: false - name: 'labels' type: Map(String) description: | User-defined labels for the Glossary. - optional: true + required: false - name: 'etag' type: String description: | Needed for resource freshness validation. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. - optional: true + required: false - name: 'uid' type: String description: | @@ -122,9 +122,9 @@ properties: type: Integer description: | The number of terms in the glossary. - optional: true + required: false - name: 'categoryCount' type: Integer description: | The number of categories in the glossary. - optional: true + required: false From 5f093b6c2c3bff3bd6ecda9015b16d860f0d2abd Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 07:12:44 +0000 Subject: [PATCH 05/72] update field --- mmv1/products/dataplex/Glossary.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index cbc05160a0a5..0b1d84530e68 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -82,7 +82,7 @@ properties: type: String description: | User specified ID of the glossary. - required: false + required: true - name: 'displayName' type: String description: | From 6fc51ff00e2f096b9db0c2a3397fb27a6eaf50e4 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 07:18:55 +0000 Subject: [PATCH 06/72] update type --- mmv1/products/dataplex/Glossary.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 0b1d84530e68..8ec5e0be2357 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -94,7 +94,7 @@ properties: The user-mutable description of the glossary. required: false - name: 'labels' - type: Map(String) + type: KeyValueLabels description: | User-defined labels for the Glossary. required: false From c4cd3128235339659cf48ba77f79a29257ce8475 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 08:24:11 +0000 Subject: [PATCH 07/72] update yaml --- mmv1/products/dataplex/Glossary.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 8ec5e0be2357..212fcfcef79d 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -73,16 +73,6 @@ properties: description: | The resource name of the Glossary. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} output: true - - name: 'location' - type: String - description: | - The location for the glossary. - required: true - - name: 'glossaryId' - type: String - description: | - User specified ID of the glossary. - required: true - name: 'displayName' type: String description: | From e26844429ad9f938f9f8c8f5d2f6e48903efbfb8 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 08:53:32 +0000 Subject: [PATCH 08/72] update IAM policy --- mmv1/products/dataplex/Glossary.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 212fcfcef79d..8f6beeb007f7 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -25,6 +25,7 @@ timeouts: update_minutes: 5 delete_minutes: 5 autogen_async: true +import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}'] async: actions: ['create', 'delete', 'update'] type: 'OpAsync' @@ -35,8 +36,10 @@ iam_policy: parent_resource_attribute: 'glossary_id' example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' import_format: - - 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary-id}}' - - '{{glossary-id}}' + [ + 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}', + '{{glossary_id}}', + ] custom_code: examples: - name: 'dataplex_glossary_basic' From 9c385c3f026b3692925a4f3b9f4ed538c1a049ef Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 09:23:48 +0000 Subject: [PATCH 09/72] updated tmpl code --- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 6 +++--- .../terraform/examples/dataplex_glossary_full.tf.tmpl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index ccb406ab2971..05c075be5836 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,5 +1,5 @@ -resource "google_dataplex_glossary" "<%= ctx[:primary_resource_id] %>" { - glossary_id = "<%= ctx[:vars]['glossary_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + glossary_id = "{{index $.Vars "glossary_name}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index a4c5f75854a2..bc891241253b 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,6 +1,6 @@ -resource "google_dataplex_glossary" "<%= ctx[:primary_resource_id] %>" { - glossary_id = "<%= ctx[:vars]['glossary_name'] %>" - project = "<%= ctx[:test_env_vars]['project_name'] %>" +resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + glossary_id = "{{index $.Vars "glossary_name}}" + project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" labels = { "tag": "test-tf" } From cc212f73774da1b2fccf6d8a9ed99bbce76f0d77 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 09:33:07 +0000 Subject: [PATCH 10/72] update tmpl code --- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 4 ++++ .../terraform/examples/dataplex_glossary_full.tf.tmpl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index 05c075be5836..51475e293f22 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -3,3 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" } + +data "google_project" "project" { + +} diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index bc891241253b..9fcf1dc40b6e 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -7,3 +7,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { display_name = "terraform glossary" description = "glossary created by Terraform" } + +data "google_project" "project" { + +} From 6126d36837434a9c5f5484c3bf91b0750b4374ae Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 09:57:05 +0000 Subject: [PATCH 11/72] remove project from resources --- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 5 ----- .../terraform/examples/dataplex_glossary_full.tf.tmpl | 5 ----- 2 files changed, 10 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index 51475e293f22..f883326d5368 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,9 +1,4 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name}}" - project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" } - -data "google_project" "project" { - -} diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index 9fcf1dc40b6e..0ce4623787a9 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,13 +1,8 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name}}" - project = "{{index $.TestEnvVars "project_name"}}" location = "us-central1" labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" } - -data "google_project" "project" { - -} From 0c31d8c066536953b447f0dfb95c83ba23c6696d Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 10:32:46 +0000 Subject: [PATCH 12/72] updated tmpl --- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 3 +-- .../terraform/examples/dataplex_glossary_full.tf.tmpl | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index f883326d5368..d910af977358 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,4 +1,3 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - glossary_id = "{{index $.Vars "glossary_name}}" - location = "us-central1" + glossary_id = "{{index $.Vars "glossary_name"}}" } diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index 0ce4623787a9..be8767babbaf 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,6 +1,5 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - glossary_id = "{{index $.Vars "glossary_name}}" - location = "us-central1" + glossary_id = "{{index $.Vars "glossary_name"}}" labels = { "tag": "test-tf" } display_name = "terraform glossary" From 1d3cf6d79a2d61cab4dfe0e6c8e4741e3c06cbd3 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 10:55:39 +0000 Subject: [PATCH 13/72] update unit test --- .../resource_dataplex_glossary_test.go | 108 +++++++++++++----- 1 file changed, 82 insertions(+), 26 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 0a1bc7923c1c..5b27360553f1 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -1,15 +1,20 @@ package dataplex_test import ( + "fmt" + "strings" "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/envvar" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/envvar" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func TestAccDataplexGlossary_update(t *testing.T) { +func TestAccDataplexGlossary_dataplexGlossaryBasicExample(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -23,47 +28,98 @@ func TestAccDataplexGlossary_update(t *testing.T) { CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccDataplexGlossary_full(context), + Config: testAccDataplexGlossary_dataplexGlossaryBasicExample(context), }, { - ResourceName: "google_dataplex_glossary.test_glossary", + ResourceName: "google_dataplex_glossary.glossary_test_id", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "glossary_id", "labels", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, }, + }, + }) +} + +func testAccDataplexGlossary_dataplexGlossaryBasicExample(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "glossary_test_id" { + glossary_id = "tf-test-glossary-basic%{random_suffix}" +} +`, context) +} + +func TestAccDataplexGlossary_dataplexGlossaryFullExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_name": envvar.GetTestProjectFromEnv(), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), + Steps: []resource.TestStep{ { - Config: testAccDataplexGlossary_update(context), + Config: testAccDataplexGlossary_dataplexGlossaryFullExample(context), }, { - ResourceName: "google_dataplex_glossary.test_glossary", + ResourceName: "google_dataplex_glossary.glossary_test_id_full", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"location", "glossary_id", "labels", "terraform_labels"}, + ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, }, }, }) } -func testAccDataplexGlossary_full(context map[string]interface{}) string { +func testAccDataplexGlossary_dataplexGlossaryFullExample(context map[string]interface{}) string { return acctest.Nprintf(` - resource "google_dataplex_glossary" "test_glossary" { - glossary_id = "tf-test-glossary%{random_suffix}" - project = "%{project_name}" - location = "us-central1" +resource "google_dataplex_glossary" "glossary_test_id_full" { + glossary_id = "tf-test-glossary-full%{random_suffix}" + labels = { "tag": "test-tf" } + display_name = "terraform glossary" + description = "glossary created by Terraform" } `, context) } -func testAccDataplexGlossary_update(context map[string]interface{}) string { - return acctest.Nprintf(` - resource "google_dataplex_glossary" "test_glossary" { - glossary_id = "tf-test-glossary%{random_suffix}" - project = "%{project_name}" - location = "us-central1" - - labels = {"tag": "test-tf"} - display_name = "terraform glossary" - description = "glossary created by Terraform" -} -`, context) +func testAccCheckDataplexGlossaryDestroyProducer(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_dataplex_glossary" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := acctest.GoogleProviderConfig(t) + + url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DataplexBasePath}}projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ + Config: config, + Method: "GET", + Project: billingProject, + RawURL: url, + UserAgent: config.UserAgent, + }) + if err == nil { + return fmt.Errorf("DataplexGlossary still exists at %s", url) + } + } + + return nil + } } From be520aa5b1d92efb7c9e8cc02a1189dce0202f1f Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 11:02:09 +0000 Subject: [PATCH 14/72] update test --- .../resource_dataplex_glossary_test.go | 52 +++---------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 5b27360553f1..4921b4d20ea8 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -1,17 +1,16 @@ package dataplex_test import ( - "fmt" - "strings" + "testing" + "testing" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/acctest" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/envvar" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" ) func TestAccDataplexGlossary_dataplexGlossaryBasicExample(t *testing.T) { @@ -84,42 +83,3 @@ resource "google_dataplex_glossary" "glossary_test_id_full" { } `, context) } - -func testAccCheckDataplexGlossaryDestroyProducer(t *testing.T) func(s *terraform.State) error { - return func(s *terraform.State) error { - for name, rs := range s.RootModule().Resources { - if rs.Type != "google_dataplex_glossary" { - continue - } - if strings.HasPrefix(name, "data.") { - continue - } - - config := acctest.GoogleProviderConfig(t) - - url, err := tpgresource.ReplaceVarsForTest(config, rs, "{{DataplexBasePath}}projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}") - if err != nil { - return err - } - - billingProject := "" - - if config.BillingProject != "" { - billingProject = config.BillingProject - } - - _, err = transport_tpg.SendRequest(transport_tpg.SendRequestOptions{ - Config: config, - Method: "GET", - Project: billingProject, - RawURL: url, - UserAgent: config.UserAgent, - }) - if err == nil { - return fmt.Errorf("DataplexGlossary still exists at %s", url) - } - } - - return nil - } -} From a0b28e814017127c5b1fb8bee1452d555e0cb9da Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 11:20:24 +0000 Subject: [PATCH 15/72] update test --- mmv1/products/dataplex/Glossary.yaml | 1 + .../dataplex/resource_dataplex_glossary_test.go | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 8f6beeb007f7..2c22b6bcd84f 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -32,6 +32,7 @@ async: operation: base_url: '{{op_id}}' iam_policy: + skip_import_test: true method_name_separator: ':' parent_resource_attribute: 'glossary_id' example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 4921b4d20ea8..8cdb9e6e0066 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -7,8 +7,6 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-provider-google/google/envvar" ) @@ -27,7 +25,7 @@ func TestAccDataplexGlossary_dataplexGlossaryBasicExample(t *testing.T) { CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccDataplexGlossary_dataplexGlossaryBasicExample(context), + Config: testAccDataplexGlossary_dataplexGlossaryBasic(context), }, { ResourceName: "google_dataplex_glossary.glossary_test_id", @@ -39,7 +37,7 @@ func TestAccDataplexGlossary_dataplexGlossaryBasicExample(t *testing.T) { }) } -func testAccDataplexGlossary_dataplexGlossaryBasicExample(context map[string]interface{}) string { +func testAccDataplexGlossary_dataplexGlossaryBasic(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_dataplex_glossary" "glossary_test_id" { glossary_id = "tf-test-glossary-basic%{random_suffix}" @@ -61,7 +59,7 @@ func TestAccDataplexGlossary_dataplexGlossaryFullExample(t *testing.T) { CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccDataplexGlossary_dataplexGlossaryFullExample(context), + Config: testAccDataplexGlossary_dataplexGlossaryFull(context), }, { ResourceName: "google_dataplex_glossary.glossary_test_id_full", @@ -73,7 +71,7 @@ func TestAccDataplexGlossary_dataplexGlossaryFullExample(t *testing.T) { }) } -func testAccDataplexGlossary_dataplexGlossaryFullExample(context map[string]interface{}) string { +func testAccDataplexGlossary_dataplexGlossaryFull(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" From 1d00422a2428f75789af739750968ffc19b6c95e Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 11:27:59 +0000 Subject: [PATCH 16/72] update yaml --- mmv1/products/dataplex/Glossary.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 2c22b6bcd84f..8f6beeb007f7 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -32,7 +32,6 @@ async: operation: base_url: '{{op_id}}' iam_policy: - skip_import_test: true method_name_separator: ':' parent_resource_attribute: 'glossary_id' example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' From 16ce8cf6e917318e46693c6026df1cf3ca4ae558 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 14:44:57 +0000 Subject: [PATCH 17/72] update unit test --- .../services/dataplex/resource_dataplex_glossary_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 8cdb9e6e0066..6c822db94dcb 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -3,15 +3,13 @@ package dataplex_test import ( "testing" - "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 TestAccDataplexGlossary_dataplexGlossaryBasicExample(t *testing.T) { +func TestAccDataplexGlossary_dataplexGlossaryBasic(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -45,7 +43,7 @@ resource "google_dataplex_glossary" "glossary_test_id" { `, context) } -func TestAccDataplexGlossary_dataplexGlossaryFullExample(t *testing.T) { +func TestAccDataplexGlossary_dataplexGlossaryFull(t *testing.T) { t.Parallel() context := map[string]interface{}{ From f6c41c884b5b86449ccf6330131df05a5b8a754c Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 15:23:43 +0000 Subject: [PATCH 18/72] update tmpl --- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 2 ++ .../terraform/examples/dataplex_glossary_full.tf.tmpl | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index d910af977358..3733186c5b28 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,3 +1,5 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name"}}" + location = "us-central1" + project = "{{index $.TestEnvVars "project_name"}}" } diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index be8767babbaf..fd81aa72afd2 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,6 +1,8 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name"}}" - + location = "us-central1" + project = "{{index $.TestEnvVars "project_name"}}" + labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" From 1534689df89fe946913fa8261a809b318f21cfbc Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 18 Feb 2025 16:35:52 +0000 Subject: [PATCH 19/72] update test --- mmv1/products/dataplex/Glossary.yaml | 2 +- .../resource_dataplex_glossary_test.go | 46 +++++++------------ 2 files changed, 18 insertions(+), 30 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 8f6beeb007f7..e45e21553dc1 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -17,7 +17,7 @@ description: | docs: base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' -create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossary_id={{glossary_id}}' +create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossaryId={{glossary_id}}' update_verb: 'PATCH' update_mask: true timeouts: diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 6c822db94dcb..737be8cbb791 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-provider-google/google/envvar" ) -func TestAccDataplexGlossary_dataplexGlossaryBasic(t *testing.T) { +func TestAccDataplexGlossary_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -23,7 +23,7 @@ func TestAccDataplexGlossary_dataplexGlossaryBasic(t *testing.T) { CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testAccDataplexGlossary_dataplexGlossaryBasic(context), + Config: testAccDataplexGlossary_update(context), }, { ResourceName: "google_dataplex_glossary.glossary_test_id", @@ -31,33 +31,8 @@ func TestAccDataplexGlossary_dataplexGlossaryBasic(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, }, - }, - }) -} - -func testAccDataplexGlossary_dataplexGlossaryBasic(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_dataplex_glossary" "glossary_test_id" { - glossary_id = "tf-test-glossary-basic%{random_suffix}" -} -`, context) -} - -func TestAccDataplexGlossary_dataplexGlossaryFull(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "project_name": envvar.GetTestProjectFromEnv(), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), - Steps: []resource.TestStep{ { - Config: testAccDataplexGlossary_dataplexGlossaryFull(context), + Config: testAccDataplexGlossary_full(context), }, { ResourceName: "google_dataplex_glossary.glossary_test_id_full", @@ -69,10 +44,23 @@ func TestAccDataplexGlossary_dataplexGlossaryFull(t *testing.T) { }) } -func testAccDataplexGlossary_dataplexGlossaryFull(context map[string]interface{}) string { +func testAccDataplexGlossary_update(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "glossary_test_id" { + glossary_id = "tf-test-glossary-basic%{random_suffix}" + location = "us-central1" + project = "%{project_name}" +} +`, context) +} + +func testAccDataplexGlossary_full(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" + location = "us-central1" + project = "%{project_name}" + labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" From 930c1f490188936dde86b387d9c9a88ba81b709b Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 07:46:19 +0000 Subject: [PATCH 20/72] add project --- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 4 ++++ .../terraform/examples/dataplex_glossary_full.tf.tmpl | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index 3733186c5b28..d14b238cee54 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -3,3 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" } + +data "google_project" "project" { + +} diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index fd81aa72afd2..704b1f432e31 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -2,8 +2,12 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" - + labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" } + +data "google_project" "project" { + +} From c2cc5b5eb364a9c229a9756dd560da8140f3bb40 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 08:29:49 +0000 Subject: [PATCH 21/72] update url --- mmv1/products/dataplex/Glossary.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index e45e21553dc1..8f6beeb007f7 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -17,7 +17,7 @@ description: | docs: base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' -create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossaryId={{glossary_id}}' +create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossary_id={{glossary_id}}' update_verb: 'PATCH' update_mask: true timeouts: From a0c14ee8efcde261f866d7406afd1e0e1fe15dfc Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 10:10:29 +0000 Subject: [PATCH 22/72] add version --- mmv1/products/dataplex/Glossary.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 8f6beeb007f7..eb531a394921 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -12,6 +12,7 @@ # limitations under the License. name: 'Glossary' +min_version: beta description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. docs: From 76ed34a79ea7d6462f982b7ac8fc51979f0dadad Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 10:17:55 +0000 Subject: [PATCH 23/72] update version --- mmv1/products/dataplex/Glossary.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index eb531a394921..b2670709e8c2 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -12,7 +12,7 @@ # limitations under the License. name: 'Glossary' -min_version: beta +min_version: private description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. docs: From d2ef220bdb362e087dda343d8cb51e9d16d1e544 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 10:22:41 +0000 Subject: [PATCH 24/72] add min version --- mmv1/products/dataplex/Glossary.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index b2670709e8c2..c4f60cba6417 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -12,7 +12,7 @@ # limitations under the License. name: 'Glossary' -min_version: private +min_version: alpha description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. docs: From 8d0d91f7ee37d441a303e13fa7b774e167f57ac6 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 10:26:36 +0000 Subject: [PATCH 25/72] update product.yaml --- mmv1/products/dataplex/product.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mmv1/products/dataplex/product.yaml b/mmv1/products/dataplex/product.yaml index 72c5bf025eb6..58c4dbde73f8 100644 --- a/mmv1/products/dataplex/product.yaml +++ b/mmv1/products/dataplex/product.yaml @@ -17,5 +17,7 @@ display_name: 'Dataplex' versions: - name: 'ga' base_url: 'https://dataplex.googleapis.com/v1/' + - name: 'alpha' + base_url: 'https://dataplex.googleapis.com/v1alpha1/' scopes: - 'https://www.googleapis.com/auth/cloud-platform' From d9913d94963d04bf6fd17d26ab624a0ccd892e00 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 10:44:42 +0000 Subject: [PATCH 26/72] update test --- .../resource_dataplex_glossary_test.go | 69 ------------------- 1 file changed, 69 deletions(-) delete mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go deleted file mode 100644 index 737be8cbb791..000000000000 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package dataplex_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 TestAccDataplexGlossary_update(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "project_name": envvar.GetTestProjectFromEnv(), - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), - Steps: []resource.TestStep{ - { - Config: testAccDataplexGlossary_update(context), - }, - { - ResourceName: "google_dataplex_glossary.glossary_test_id", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, - }, - { - Config: testAccDataplexGlossary_full(context), - }, - { - ResourceName: "google_dataplex_glossary.glossary_test_id_full", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, - }, - }, - }) -} - -func testAccDataplexGlossary_update(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_dataplex_glossary" "glossary_test_id" { - glossary_id = "tf-test-glossary-basic%{random_suffix}" - location = "us-central1" - project = "%{project_name}" -} -`, context) -} - -func testAccDataplexGlossary_full(context map[string]interface{}) string { - return acctest.Nprintf(` -resource "google_dataplex_glossary" "glossary_test_id_full" { - glossary_id = "tf-test-glossary-full%{random_suffix}" - location = "us-central1" - project = "%{project_name}" - - labels = { "tag": "test-tf" } - display_name = "terraform glossary" - description = "glossary created by Terraform" -} -`, context) -} From e837d9495bf23da0b8d3b12c3e29976b024515e9 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 11:22:37 +0000 Subject: [PATCH 27/72] add test --- .../examples/dataplex_glossary_basic.tf.tmpl | 3 - .../examples/dataplex_glossary_full.tf.tmpl | 4 -- .../resource_dataplex_glossary_test.go | 68 +++++++++++++++++++ 3 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index d14b238cee54..b6cb79a84b1b 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -4,6 +4,3 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { project = "{{index $.TestEnvVars "project_name"}}" } -data "google_project" "project" { - -} diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index 704b1f432e31..a9c34856386c 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -7,7 +7,3 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { display_name = "terraform glossary" description = "glossary created by Terraform" } - -data "google_project" "project" { - -} diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go new file mode 100644 index 000000000000..999f90ee7699 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -0,0 +1,68 @@ +package dataplex_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 TestAccDataplexGlossary_update(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_name": envvar.GetTestProjectFromEnv(), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossary_update(context), + }, + { + ResourceName: "google_dataplex_glossary.glossary_test_id", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, + }, + { + Config: testAccDataplexGlossary_full(context), + }, + { + ResourceName: "google_dataplex_glossary.glossary_test_id_full", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, + }, + }, + }) +} + +func testAccDataplexGlossary_update(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "glossary_test_id" { + glossary_id = "tf-test-glossary-basic%{random_suffix}" + location = "us-central1" + project = "%{project_name}" +} +`, context) +} + +func testAccDataplexGlossary_full(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "glossary_test_id_full" { + glossary_id = "tf-test-glossary-full%{random_suffix}" + location = "us-central1" + project = "%{project_name}" + labels = { "tag": "test-tf" } + display_name = "terraform glossary" + description = "glossary created by Terraform" +} +`, context) +} From d6198b023c1463cb889bd87a6d398c8895da4c8e Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 12:29:23 +0000 Subject: [PATCH 28/72] update status to beta --- mmv1/products/dataplex/Glossary.yaml | 4 +++- mmv1/products/dataplex/product.yaml | 2 +- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 4 ++++ .../terraform/examples/dataplex_glossary_full.tf.tmpl | 5 +++++ .../services/dataplex/resource_dataplex_glossary_test.go | 3 +-- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index c4f60cba6417..2931c6cdd239 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -12,7 +12,7 @@ # limitations under the License. name: 'Glossary' -min_version: alpha +min_version: beta description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. docs: @@ -44,6 +44,7 @@ iam_policy: custom_code: examples: - name: 'dataplex_glossary_basic' + min_version: beta primary_resource_id: 'glossary_test_id' primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: @@ -51,6 +52,7 @@ examples: test_env_vars: project_name: 'PROJECT_NAME' - name: 'dataplex_glossary_full' + min_version: beta primary_resource_id: 'glossary_test_id_full' primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: diff --git a/mmv1/products/dataplex/product.yaml b/mmv1/products/dataplex/product.yaml index 58c4dbde73f8..c0be48b32312 100644 --- a/mmv1/products/dataplex/product.yaml +++ b/mmv1/products/dataplex/product.yaml @@ -17,7 +17,7 @@ display_name: 'Dataplex' versions: - name: 'ga' base_url: 'https://dataplex.googleapis.com/v1/' - - name: 'alpha' + - name: 'beta' base_url: 'https://dataplex.googleapis.com/v1alpha1/' scopes: - 'https://www.googleapis.com/auth/cloud-platform' diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index b6cb79a84b1b..cf1caf247472 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,6 +1,10 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" } +data "google_project" "project" { + provider = google-beta +} diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index a9c34856386c..c7b80640f4da 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,4 +1,5 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" @@ -7,3 +8,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { display_name = "terraform glossary" description = "glossary created by Terraform" } + +data "google_project" "project" { + provider = google-beta +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 999f90ee7699..cd1b3ead273c 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -19,8 +19,7 @@ func TestAccDataplexGlossary_update(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - CheckDestroy: testAccCheckDataplexGlossaryDestroyProducer(t), + ProtoV5ProviderFactories: acctest.ProtoV5BetaProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataplexGlossary_update(context), From 0d23ebb655bebadee22d8f5946ab674379533fa5 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 12:40:28 +0000 Subject: [PATCH 29/72] typo in provider --- .../services/dataplex/resource_dataplex_glossary_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index cd1b3ead273c..9afc0e467fb8 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -19,7 +19,7 @@ func TestAccDataplexGlossary_update(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5BetaProviderFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), Steps: []resource.TestStep{ { Config: testAccDataplexGlossary_update(context), From 14c7274f19d7f2e2db33324c3f6115379d64eb5a Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 13:07:49 +0000 Subject: [PATCH 30/72] update test with beta --- .../services/dataplex/resource_dataplex_glossary_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 9afc0e467fb8..01636bf0b5e2 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -49,6 +49,7 @@ resource "google_dataplex_glossary" "glossary_test_id" { glossary_id = "tf-test-glossary-basic%{random_suffix}" location = "us-central1" project = "%{project_name}" + provider = google-beta } `, context) } @@ -59,6 +60,7 @@ resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" location = "us-central1" project = "%{project_name}" + provider = google-beta labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" From 08fcec945293e0524632cad984cc23740718c699 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 13:39:26 +0000 Subject: [PATCH 31/72] add if condition --- .../services/dataplex/resource_dataplex_glossary_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go index 01636bf0b5e2..17bd0063271b 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go @@ -1,5 +1,7 @@ package dataplex_test +{{- if ne .TargetVersionName "ga" }} + import ( "testing" @@ -67,3 +69,5 @@ resource "google_dataplex_glossary" "glossary_test_id_full" { } `, context) } + +{{- end }} \ No newline at end of file From 3b13d655413f690d98ae0301e6b0ffd760b19575 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 13:45:06 +0000 Subject: [PATCH 32/72] update go file with tmpl --- ...> resource_dataplex_glossary_test.go.tmpl} | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) rename mmv1/third_party/terraform/services/dataplex/{resource_dataplex_glossary_test.go => resource_dataplex_glossary_test.go.tmpl} (82%) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl similarity index 82% rename from mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go rename to mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index 17bd0063271b..a8fe215b3efa 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -1,6 +1,6 @@ package dataplex_test -{{- if ne .TargetVersionName "ga" }} +{{- if ne $.TargetVersionName "ga" }} import ( "testing" @@ -47,17 +47,26 @@ func TestAccDataplexGlossary_update(t *testing.T) { func testAccDataplexGlossary_update(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_dataplex_glossary" "glossary_test_id" { - glossary_id = "tf-test-glossary-basic%{random_suffix}" - location = "us-central1" - project = "%{project_name}" - provider = google-beta -} + data "google_project" "project" { + provider = google-beta + } + + resource "google_dataplex_glossary" "glossary_test_id" { + glossary_id = "tf-test-glossary-basic%{random_suffix}" + location = "us-central1" + project = "%{project_name}" + provider = google-beta + } `, context) } func testAccDataplexGlossary_full(context map[string]interface{}) string { return acctest.Nprintf(` + +data "google_project" "project" { + provider = google-beta +} + resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" location = "us-central1" From 9c530bb7ea8180c6bdf742d42c12183218d929a6 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Wed, 19 Feb 2025 14:22:13 +0000 Subject: [PATCH 33/72] update product.yaml --- mmv1/products/dataplex/product.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/dataplex/product.yaml b/mmv1/products/dataplex/product.yaml index c0be48b32312..2cf1a056c499 100644 --- a/mmv1/products/dataplex/product.yaml +++ b/mmv1/products/dataplex/product.yaml @@ -18,6 +18,6 @@ versions: - name: 'ga' base_url: 'https://dataplex.googleapis.com/v1/' - name: 'beta' - base_url: 'https://dataplex.googleapis.com/v1alpha1/' + base_url: 'https://dataplex.googleapis.com/v1/' scopes: - 'https://www.googleapis.com/auth/cloud-platform' From 9d7065e56483a054a010df3390d3a0bccb22b518 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 8 May 2025 08:51:44 +0000 Subject: [PATCH 34/72] update min version --- mmv1/products/dataplex/Glossary.yaml | 3 --- mmv1/products/dataplex/product.yaml | 2 -- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 2 -- .../terraform/examples/dataplex_glossary_full.tf.tmpl | 4 +--- .../dataplex/resource_dataplex_glossary_test.go.tmpl | 6 +----- 5 files changed, 2 insertions(+), 15 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 2931c6cdd239..8f6beeb007f7 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -12,7 +12,6 @@ # limitations under the License. name: 'Glossary' -min_version: beta description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. docs: @@ -44,7 +43,6 @@ iam_policy: custom_code: examples: - name: 'dataplex_glossary_basic' - min_version: beta primary_resource_id: 'glossary_test_id' primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: @@ -52,7 +50,6 @@ examples: test_env_vars: project_name: 'PROJECT_NAME' - name: 'dataplex_glossary_full' - min_version: beta primary_resource_id: 'glossary_test_id_full' primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: diff --git a/mmv1/products/dataplex/product.yaml b/mmv1/products/dataplex/product.yaml index 2cf1a056c499..72c5bf025eb6 100644 --- a/mmv1/products/dataplex/product.yaml +++ b/mmv1/products/dataplex/product.yaml @@ -17,7 +17,5 @@ display_name: 'Dataplex' versions: - name: 'ga' base_url: 'https://dataplex.googleapis.com/v1/' - - name: 'beta' - base_url: 'https://dataplex.googleapis.com/v1/' scopes: - 'https://www.googleapis.com/auth/cloud-platform' diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index cf1caf247472..9ef104bc371d 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,10 +1,8 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" } data "google_project" "project" { - provider = google-beta } diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index c7b80640f4da..e06681a41213 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,5 +1,4 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" @@ -10,5 +9,4 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } data "google_project" "project" { - provider = google-beta -} \ No newline at end of file +} diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index a8fe215b3efa..09251e160c1c 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -48,14 +48,12 @@ func TestAccDataplexGlossary_update(t *testing.T) { func testAccDataplexGlossary_update(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { - provider = google-beta } resource "google_dataplex_glossary" "glossary_test_id" { glossary_id = "tf-test-glossary-basic%{random_suffix}" location = "us-central1" project = "%{project_name}" - provider = google-beta } `, context) } @@ -64,14 +62,12 @@ func testAccDataplexGlossary_full(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { - provider = google-beta } resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" location = "us-central1" project = "%{project_name}" - provider = google-beta labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" @@ -79,4 +75,4 @@ resource "google_dataplex_glossary" "glossary_test_id_full" { `, context) } -{{- end }} \ No newline at end of file +{{- end }} From 9ddd666077f902d1ea1d116db0df29fc90d5212e Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 8 May 2025 09:16:04 +0000 Subject: [PATCH 35/72] Revert "update min version" This reverts commit 9d7065e56483a054a010df3390d3a0bccb22b518. --- mmv1/products/dataplex/Glossary.yaml | 3 +++ mmv1/products/dataplex/product.yaml | 2 ++ .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 2 ++ .../terraform/examples/dataplex_glossary_full.tf.tmpl | 4 +++- .../dataplex/resource_dataplex_glossary_test.go.tmpl | 6 +++++- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 8f6beeb007f7..2931c6cdd239 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -12,6 +12,7 @@ # limitations under the License. name: 'Glossary' +min_version: beta description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. docs: @@ -43,6 +44,7 @@ iam_policy: custom_code: examples: - name: 'dataplex_glossary_basic' + min_version: beta primary_resource_id: 'glossary_test_id' primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: @@ -50,6 +52,7 @@ examples: test_env_vars: project_name: 'PROJECT_NAME' - name: 'dataplex_glossary_full' + min_version: beta primary_resource_id: 'glossary_test_id_full' primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: diff --git a/mmv1/products/dataplex/product.yaml b/mmv1/products/dataplex/product.yaml index 72c5bf025eb6..2cf1a056c499 100644 --- a/mmv1/products/dataplex/product.yaml +++ b/mmv1/products/dataplex/product.yaml @@ -17,5 +17,7 @@ display_name: 'Dataplex' versions: - name: 'ga' base_url: 'https://dataplex.googleapis.com/v1/' + - name: 'beta' + base_url: 'https://dataplex.googleapis.com/v1/' scopes: - 'https://www.googleapis.com/auth/cloud-platform' diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index 9ef104bc371d..cf1caf247472 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,8 +1,10 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" } data "google_project" "project" { + provider = google-beta } diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index e06681a41213..c7b80640f4da 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,4 +1,5 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" @@ -9,4 +10,5 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } data "google_project" "project" { -} + provider = google-beta +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index 09251e160c1c..a8fe215b3efa 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -48,12 +48,14 @@ func TestAccDataplexGlossary_update(t *testing.T) { func testAccDataplexGlossary_update(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { + provider = google-beta } resource "google_dataplex_glossary" "glossary_test_id" { glossary_id = "tf-test-glossary-basic%{random_suffix}" location = "us-central1" project = "%{project_name}" + provider = google-beta } `, context) } @@ -62,12 +64,14 @@ func testAccDataplexGlossary_full(context map[string]interface{}) string { return acctest.Nprintf(` data "google_project" "project" { + provider = google-beta } resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" location = "us-central1" project = "%{project_name}" + provider = google-beta labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" @@ -75,4 +79,4 @@ resource "google_dataplex_glossary" "glossary_test_id_full" { `, context) } -{{- end }} +{{- end }} \ No newline at end of file From f2b6fc3f9617b5500b0eb2dda49a0ca458fe79d2 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 8 May 2025 09:50:50 +0000 Subject: [PATCH 36/72] add etag --- .../templates/terraform/examples/dataplex_glossary_basic.tf.tmpl | 1 + mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl | 1 + 2 files changed, 2 insertions(+) diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index cf1caf247472..4d71aa22b9b3 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -3,6 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" + etag = "google-internal" } data "google_project" "project" { diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index c7b80640f4da..b0e1a32d3432 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -3,6 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" + etag = "Google-internal" labels = { "tag": "test-tf" } display_name = "terraform glossary" From d46521b1415af4d6bba975ba73cab968ff365df4 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 8 May 2025 11:26:57 +0000 Subject: [PATCH 37/72] remove etag --- mmv1/products/dataplex/Glossary.yaml | 7 ++----- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 1 - .../terraform/examples/dataplex_glossary_full.tf.tmpl | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 2931c6cdd239..a39336c16097 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -94,11 +94,6 @@ properties: description: | User-defined labels for the Glossary. required: false - - name: 'etag' - type: String - description: | - Needed for resource freshness validation. This checksum is computed by the server based on the value of other fields, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. - required: false - name: 'uid' type: String description: | @@ -119,8 +114,10 @@ properties: description: | The number of terms in the glossary. required: false + output: true - name: 'categoryCount' type: Integer description: | The number of categories in the glossary. required: false + output: true diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index 4d71aa22b9b3..cf1caf247472 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -3,7 +3,6 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" - etag = "google-internal" } data "google_project" "project" { diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index b0e1a32d3432..c7b80640f4da 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -3,7 +3,6 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" project = "{{index $.TestEnvVars "project_name"}}" - etag = "Google-internal" labels = { "tag": "test-tf" } display_name = "terraform glossary" From d0e8bb678c00f9f18bdbadb40ebd9d604cf42133 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 8 May 2025 17:23:49 +0000 Subject: [PATCH 38/72] remove glossary_id from import format --- mmv1/products/dataplex/Glossary.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index a39336c16097..317c6a66f445 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -33,14 +33,12 @@ async: operation: base_url: '{{op_id}}' iam_policy: + exclude_import_test: true method_name_separator: ':' parent_resource_attribute: 'glossary_id' example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' import_format: - [ - 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}', - '{{glossary_id}}', - ] + - 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' custom_code: examples: - name: 'dataplex_glossary_basic' From 69686a7de26ef2763e361df1088d476b7736bd0c Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 9 May 2025 08:49:51 +0000 Subject: [PATCH 39/72] apply fixes related to project removal --- mmv1/products/dataplex/Glossary.yaml | 13 +++----- mmv1/products/dataplex/product.yaml | 2 -- .../examples/dataplex_glossary_basic.tf.tmpl | 5 --- .../examples/dataplex_glossary_full.tf.tmpl | 5 --- .../resource_dataplex_glossary_test.go.tmpl | 33 ++++++++----------- 5 files changed, 17 insertions(+), 41 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 317c6a66f445..3d31ec92109a 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -1,4 +1,4 @@ -# Copyright 2024 Google Inc. +# Copyright 2025 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 @@ -15,7 +15,6 @@ name: 'Glossary' min_version: beta description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. -docs: base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossary_id={{glossary_id}}' @@ -33,7 +32,6 @@ async: operation: base_url: '{{op_id}}' iam_policy: - exclude_import_test: true method_name_separator: ':' parent_resource_attribute: 'glossary_id' example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' @@ -44,19 +42,15 @@ examples: - name: 'dataplex_glossary_basic' min_version: beta primary_resource_id: 'glossary_test_id' - primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + primary_resource_name: 'fmt.Sprintf("tf-test-glossary-basic%s", context["random_suffix"])' vars: glossary_name: 'glossary-basic' - test_env_vars: - project_name: 'PROJECT_NAME' - name: 'dataplex_glossary_full' min_version: beta primary_resource_id: 'glossary_test_id_full' - primary_resource_name: 'fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + primary_resource_name: 'fmt.Sprintf("tf-test-glossary-full%s", context["random_suffix"])' vars: glossary_name: 'glossary-full' - test_env_vars: - project_name: 'PROJECT_NAME' parameters: - name: 'location' type: String @@ -70,6 +64,7 @@ parameters: description: | The glossary id for creation. url_param_only: true + required: true immutable: true properties: - name: 'name' diff --git a/mmv1/products/dataplex/product.yaml b/mmv1/products/dataplex/product.yaml index 2cf1a056c499..72c5bf025eb6 100644 --- a/mmv1/products/dataplex/product.yaml +++ b/mmv1/products/dataplex/product.yaml @@ -17,7 +17,5 @@ display_name: 'Dataplex' versions: - name: 'ga' base_url: 'https://dataplex.googleapis.com/v1/' - - name: 'beta' - base_url: 'https://dataplex.googleapis.com/v1/' scopes: - 'https://www.googleapis.com/auth/cloud-platform' diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index cf1caf247472..6df27c5cc7f0 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -2,9 +2,4 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" - project = "{{index $.TestEnvVars "project_name"}}" -} - -data "google_project" "project" { - provider = google-beta } diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index c7b80640f4da..07a64ca141d3 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -2,13 +2,8 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" - project = "{{index $.TestEnvVars "project_name"}}" labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" } - -data "google_project" "project" { - provider = google-beta -} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index a8fe215b3efa..1b40425e35ee 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -15,7 +15,6 @@ func TestAccDataplexGlossary_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ - "project_name": envvar.GetTestProjectFromEnv(), "random_suffix": acctest.RandString(t, 10), } @@ -34,6 +33,11 @@ func TestAccDataplexGlossary_update(t *testing.T) { }, { Config: testAccDataplexGlossary_full(context), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("google_dataplex_glossary.glossary_test_id", plancheck.ResourceActionUpdate), + }, + }, }, { ResourceName: "google_dataplex_glossary.glossary_test_id_full", @@ -47,14 +51,9 @@ func TestAccDataplexGlossary_update(t *testing.T) { func testAccDataplexGlossary_update(context map[string]interface{}) string { return acctest.Nprintf(` - data "google_project" "project" { - provider = google-beta - } - resource "google_dataplex_glossary" "glossary_test_id" { glossary_id = "tf-test-glossary-basic%{random_suffix}" location = "us-central1" - project = "%{project_name}" provider = google-beta } `, context) @@ -62,20 +61,14 @@ func testAccDataplexGlossary_update(context map[string]interface{}) string { func testAccDataplexGlossary_full(context map[string]interface{}) string { return acctest.Nprintf(` - -data "google_project" "project" { - provider = google-beta -} - -resource "google_dataplex_glossary" "glossary_test_id_full" { - glossary_id = "tf-test-glossary-full%{random_suffix}" - location = "us-central1" - project = "%{project_name}" - provider = google-beta - labels = { "tag": "test-tf" } - display_name = "terraform glossary" - description = "glossary created by Terraform" -} + resource "google_dataplex_glossary" "glossary_test_id_full" { + glossary_id = "tf-test-glossary-full%{random_suffix}" + location = "us-central1" + provider = google-beta + labels = { "tag": "test-tf" } + display_name = "terraform glossary" + description = "glossary created by Terraform" + } `, context) } From 6acc0f13ff176ec18bb4210cfd7c4a205cf08b06 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 9 May 2025 08:54:47 +0000 Subject: [PATCH 40/72] remove beta as a provider --- mmv1/products/dataplex/Glossary.yaml | 3 --- .../terraform/examples/dataplex_glossary_basic.tf.tmpl | 1 - .../terraform/examples/dataplex_glossary_full.tf.tmpl | 1 - .../services/dataplex/resource_dataplex_glossary_test.go.tmpl | 2 -- 4 files changed, 7 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 3d31ec92109a..eb454a885001 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -12,7 +12,6 @@ # limitations under the License. name: 'Glossary' -min_version: beta description: | Represents a collection of categories and terms defined by the user. Glossary is a top level resource and is the GCP parent resource of all the categories and terms within it. base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' @@ -40,13 +39,11 @@ iam_policy: custom_code: examples: - name: 'dataplex_glossary_basic' - min_version: beta primary_resource_id: 'glossary_test_id' primary_resource_name: 'fmt.Sprintf("tf-test-glossary-basic%s", context["random_suffix"])' vars: glossary_name: 'glossary-basic' - name: 'dataplex_glossary_full' - min_version: beta primary_resource_id: 'glossary_test_id_full' primary_resource_name: 'fmt.Sprintf("tf-test-glossary-full%s", context["random_suffix"])' vars: diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl index 6df27c5cc7f0..a4cac769a527 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_basic.tf.tmpl @@ -1,5 +1,4 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" } diff --git a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl index 07a64ca141d3..f232b710c176 100644 --- a/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_full.tf.tmpl @@ -1,5 +1,4 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - provider = google-beta glossary_id = "{{index $.Vars "glossary_name"}}" location = "us-central1" diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index 1b40425e35ee..879c3611d0b3 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -54,7 +54,6 @@ func testAccDataplexGlossary_update(context map[string]interface{}) string { resource "google_dataplex_glossary" "glossary_test_id" { glossary_id = "tf-test-glossary-basic%{random_suffix}" location = "us-central1" - provider = google-beta } `, context) } @@ -64,7 +63,6 @@ func testAccDataplexGlossary_full(context map[string]interface{}) string { resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" location = "us-central1" - provider = google-beta labels = { "tag": "test-tf" } display_name = "terraform glossary" description = "glossary created by Terraform" From f85585a04d1e6633f301a2f68c1c36da26e68fab Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 9 May 2025 09:13:46 +0000 Subject: [PATCH 41/72] added plancheck import --- .../services/dataplex/resource_dataplex_glossary_test.go.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index 879c3611d0b3..afe7db6aa0af 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -8,7 +8,7 @@ import ( "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-plugin-testing/plancheck" ) func TestAccDataplexGlossary_update(t *testing.T) { From a94e74944bcd6745047db95757e89d7dba2ae60d Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Mon, 12 May 2025 05:19:23 +0000 Subject: [PATCH 42/72] update import key --- mmv1/products/dataplex/Glossary.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index eb454a885001..4f1d52993bfa 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -36,6 +36,7 @@ iam_policy: example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' import_format: - 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' + - '{{glossary_id}}' custom_code: examples: - name: 'dataplex_glossary_basic' From 3bfc21f050651d2d91c20690f5a617d4a689dc29 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Mon, 12 May 2025 18:13:57 +0000 Subject: [PATCH 43/72] minor fixes: --- mmv1/products/dataplex/Glossary.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index 4f1d52993bfa..a47c435ee8ca 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -33,11 +33,9 @@ async: iam_policy: method_name_separator: ':' parent_resource_attribute: 'glossary_id' - example_config_body: 'templates/terraform/iam/iam_attributes.go.tmpl' import_format: - 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}' - '{{glossary_id}}' -custom_code: examples: - name: 'dataplex_glossary_basic' primary_resource_id: 'glossary_test_id' From 0381efb242a31b4877b4751c6aa611cacf984971 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Mon, 12 May 2025 19:01:46 +0000 Subject: [PATCH 44/72] minor fixes --- .../services/dataplex/resource_dataplex_glossary_test.go.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index afe7db6aa0af..62b4dfe9d9f6 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -20,7 +20,7 @@ func TestAccDataplexGlossary_update(t *testing.T) { acctest.VcrTest(t, resource.TestCase{ PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { Config: testAccDataplexGlossary_update(context), From 4b491a3d1583cb0ac567c6967f8346ef8493fd13 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Mon, 12 May 2025 19:33:35 +0000 Subject: [PATCH 45/72] updated update function --- .../dataplex/resource_dataplex_glossary_test.go.tmpl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index 62b4dfe9d9f6..8072809c22c0 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -51,9 +51,12 @@ func TestAccDataplexGlossary_update(t *testing.T) { func testAccDataplexGlossary_update(context map[string]interface{}) string { return acctest.Nprintf(` - resource "google_dataplex_glossary" "glossary_test_id" { - glossary_id = "tf-test-glossary-basic%{random_suffix}" + resource "google_dataplex_glossary" "glossary_test_id_full" { + glossary_id = "tf-test-glossary-full%{random_suffix}" location = "us-central1" + labels = { "tag": "test-tf" } + display_name = "terraform glossary" + description = "glossary updated by Terraform" } `, context) } From ac88aca965ca4cf3fad6a121e4ddb008dd5eab04 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 04:43:15 +0000 Subject: [PATCH 46/72] update testId --- .../dataplex/resource_dataplex_glossary_test.go.tmpl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl index 8072809c22c0..a2be0e83b12f 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_test.go.tmpl @@ -26,7 +26,7 @@ func TestAccDataplexGlossary_update(t *testing.T) { Config: testAccDataplexGlossary_update(context), }, { - ResourceName: "google_dataplex_glossary.glossary_test_id", + ResourceName: "google_dataplex_glossary.glossary_test_id_full", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "terraform_labels"}, @@ -35,7 +35,7 @@ func TestAccDataplexGlossary_update(t *testing.T) { Config: testAccDataplexGlossary_full(context), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("google_dataplex_glossary.glossary_test_id", plancheck.ResourceActionUpdate), + plancheck.ExpectResourceAction("google_dataplex_glossary.glossary_test_id_full", plancheck.ResourceActionUpdate), }, }, }, @@ -54,9 +54,6 @@ func testAccDataplexGlossary_update(context map[string]interface{}) string { resource "google_dataplex_glossary" "glossary_test_id_full" { glossary_id = "tf-test-glossary-full%{random_suffix}" location = "us-central1" - labels = { "tag": "test-tf" } - display_name = "terraform glossary" - description = "glossary updated by Terraform" } `, context) } From 91e15d3d966bb831759d62766d3a31e7f78f57b7 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 07:17:23 +0000 Subject: [PATCH 47/72] add terraform support for glossary category --- mmv1/products/dataplex/Category.yaml | 114 ++++++++++++++++++ .../examples/dataplex_category_basic.tf.tmpl | 13 ++ .../examples/dataplex_category_full.tf.tmpl | 15 +++ 3 files changed, 142 insertions(+) create mode 100644 mmv1/products/dataplex/Category.yaml create mode 100644 mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl create mode 100644 mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/Category.yaml new file mode 100644 index 000000000000..f7d6c2907358 --- /dev/null +++ b/mmv1/products/dataplex/Category.yaml @@ -0,0 +1,114 @@ +# 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: 'Category' +description: | + Represents a collection of categories and terms within a Glossary that are related to each other. +base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' +self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' +create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories?category_id={{category_id}}' +update_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' +update_verb: 'PATCH' +update_mask: true +delete_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' +timeouts: + insert_minutes: 5 + update_minutes: 5 + delete_minutes: 5 +autogen_async: true +import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'] +async: + actions: ['create', 'delete', 'update'] + type: 'OpAsync' + operation: + base_url: '{{op_id}}' +iam_policy: + method_name_separator: ':' + parent_resource_attribute: 'category_id' + import_format: + [ + 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}', + '{{category_id}}', + ] +examples: + - name: 'dataplex_category_basic' + primary_resource_id: 'category_test_id' + primary_resource_name: 'fmt.Sprintf("tf-test-category-basic%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + vars: + category_name: 'category-basic' + - name: 'dataplex_category_full' + primary_resource_id: 'category_test_id_full' + primary_resource_name: 'fmt.Sprintf("tf-test-category-full%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + vars: + category_name: 'category-full' +parameters: + - name: 'location' + type: String + description: | + The location where the glossary category should reside. + url_param_only: true + required: true + immutable: true + - name: 'glossaryId' + type: String + description: | + The glossary id for creation. + url_param_only: true + immutable: true + - name: 'categoryId' + type: String + description: | + The category id for creation. + url_param_only: true + immutable: true +properties: + - name: 'name' + type: String + description: | + The resource name of the GlossaryCategory. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/categories/{categoryId} + output: true + - name: 'displayName' + type: String + description: | + User friendly display name of the GlossaryCategory. This is user-mutable. This will be same as the categoryId, if not specified. + required: false + - name: 'description' + type: String + description: | + The user-mutable description of the GlossaryCategory. + required: false + - name: 'labels' + type: KeyValueLabels + description: | + User-defined labels for the GlossaryCategory. + required: false + - name: 'uid' + type: String + description: | + System generated unique id for the GlossaryCategory. This ID will be different if the GlossaryCategory is deleted and re-created with the same name. + output: true + - name: 'createTime' + type: Timestamp + description: | + The time at which the GlossaryCategory was created. + output: true + - name: 'updateTime' + type: Timestamp + description: | + The time at which the GlossaryCategory was last updated. + output: true + - name: 'parent' + type: String + description: | + The immediate parent of the GlossaryCategory in the resource-hierarchy. It can either be a Glossary or a Category. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} OR projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/categories/{categoryId} + required: true \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl new file mode 100644 index 000000000000..1534a1bdfbab --- /dev/null +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -0,0 +1,13 @@ +resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + name = "tf-test-glossary%{random_suffix}" + location = "{{$.Vars.location}}" + project = "{{index $.TestEnvVars "project_name"}}" +} + +resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/{{$.Vars.location}}/glossaries/${google_dataplex_glossary.glossary.name}" + glossary_id = google_dataplex_glossary.{{$.PrimaryResourceId}}.name + location = "{{$.Vars.location}}" + project = "{{index $.TestEnvVars "project_name"}}" + category_id = "tf-test-category-basic%{random_suffix}" +} diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl new file mode 100644 index 000000000000..f9a933d8da58 --- /dev/null +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -0,0 +1,15 @@ +resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + name = "tf-test-glossary%{random_suffix}" + location = "{{$.Vars.location}}" +} + +resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/{{$.Vars.location}}/glossaries/${google_dataplex_glossary.glossary.name}" + glossary_id = google_dataplex_glossary.{{$.PrimaryResourceId}}.name + location = "{{$.Vars.location}}" + category_id = "tf-test-category-full%{random_suffix}" + + labels = { "tag": "test-tf" } + display_name = "terraform category" + description = "category created by Terraform" +} From 4800355d93554e8122f305e98811495c900bd372 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 07:28:50 +0000 Subject: [PATCH 48/72] added blank line --- mmv1/products/dataplex/Category.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/Category.yaml index f7d6c2907358..8696d32d225a 100644 --- a/mmv1/products/dataplex/Category.yaml +++ b/mmv1/products/dataplex/Category.yaml @@ -111,4 +111,4 @@ properties: type: String description: | The immediate parent of the GlossaryCategory in the resource-hierarchy. It can either be a Glossary or a Category. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} OR projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/categories/{categoryId} - required: true \ No newline at end of file + required: true From 352d5f1042db4fd45b163acb6d17cb7687c7e748 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 07:47:33 +0000 Subject: [PATCH 49/72] add glossary_id --- mmv1/products/dataplex/Category.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/Category.yaml index 8696d32d225a..1fa484f614cc 100644 --- a/mmv1/products/dataplex/Category.yaml +++ b/mmv1/products/dataplex/Category.yaml @@ -39,6 +39,7 @@ iam_policy: [ 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}', '{{category_id}}', + '{{glossary_id}}', ] examples: - name: 'dataplex_category_basic' From de09a9c9f502c0a5ec922479bd9fe9c15a9a6c01 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 08:06:04 +0000 Subject: [PATCH 50/72] update tmpl --- .../terraform/examples/dataplex_category_basic.tf.tmpl | 8 +++----- .../terraform/examples/dataplex_category_full.tf.tmpl | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index 1534a1bdfbab..8ef69f4d4c09 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -1,13 +1,11 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - name = "tf-test-glossary%{random_suffix}" + glossary_id = "tf-test-glossary%{random_suffix}" location = "{{$.Vars.location}}" - project = "{{index $.TestEnvVars "project_name"}}" } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/{{$.Vars.location}}/glossaries/${google_dataplex_glossary.glossary.name}" - glossary_id = google_dataplex_glossary.{{$.PrimaryResourceId}}.name + parent = "google_dataplex_glossary.glossary.name" + glossary_id = google_dataplex_glossary.glossary.glossary_id location = "{{$.Vars.location}}" - project = "{{index $.TestEnvVars "project_name"}}" category_id = "tf-test-category-basic%{random_suffix}" } diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index f9a933d8da58..f40f347038d9 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -1,11 +1,11 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - name = "tf-test-glossary%{random_suffix}" + glossary_id = "tf-test-glossary%{random_suffix}" location = "{{$.Vars.location}}" } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/{{$.Vars.location}}/glossaries/${google_dataplex_glossary.glossary.name}" - glossary_id = google_dataplex_glossary.{{$.PrimaryResourceId}}.name + parent = "google_dataplex_glossary.glossary.name" + glossary_id = google_dataplex_glossary.glossary.glossary_id location = "{{$.Vars.location}}" category_id = "tf-test-category-full%{random_suffix}" From ae6042be760672e467324f39e8092deaab7eedb5 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 08:15:21 +0000 Subject: [PATCH 51/72] update resource name --- .../terraform/examples/dataplex_category_basic.tf.tmpl | 4 ++-- .../terraform/examples/dataplex_category_full.tf.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index 8ef69f4d4c09..a591b1219cba 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -4,8 +4,8 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "google_dataplex_glossary.glossary.name" - glossary_id = google_dataplex_glossary.glossary.glossary_id + parent = "google_dataplex_glossary.category_test_id.name" + glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "{{$.Vars.location}}" category_id = "tf-test-category-basic%{random_suffix}" } diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index f40f347038d9..bfa39acbfbbd 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -4,8 +4,8 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "google_dataplex_glossary.glossary.name" - glossary_id = google_dataplex_glossary.glossary.glossary_id + parent = "google_dataplex_glossary.category_test_id.name" + glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "{{$.Vars.location}}" category_id = "tf-test-category-full%{random_suffix}" From 0f12097a8f502a1092aa8cc0fb22367f7c85aaa3 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 08:42:16 +0000 Subject: [PATCH 52/72] add location --- .../terraform/examples/dataplex_category_basic.tf.tmpl | 4 ++-- .../terraform/examples/dataplex_category_full.tf.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index a591b1219cba..4c4ce56ad2b5 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "tf-test-glossary%{random_suffix}" - location = "{{$.Vars.location}}" + location = "us-central1" } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { parent = "google_dataplex_glossary.category_test_id.name" glossary_id = google_dataplex_glossary.category_test_id.glossary_id - location = "{{$.Vars.location}}" + location = "us-central1" category_id = "tf-test-category-basic%{random_suffix}" } diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index bfa39acbfbbd..9f57c78d0015 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -1,12 +1,12 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { glossary_id = "tf-test-glossary%{random_suffix}" - location = "{{$.Vars.location}}" + location = "us-central1" } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { parent = "google_dataplex_glossary.category_test_id.name" glossary_id = google_dataplex_glossary.category_test_id.glossary_id - location = "{{$.Vars.location}}" + location = "us-central1" category_id = "tf-test-category-full%{random_suffix}" labels = { "tag": "test-tf" } From 82a05cdd20214820c4576e3bc954d699756508b6 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 09:10:59 +0000 Subject: [PATCH 53/72] updated parent --- .../terraform/examples/dataplex_category_basic.tf.tmpl | 2 +- .../templates/terraform/examples/dataplex_category_full.tf.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index 4c4ce56ad2b5..ee0304684f58 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "google_dataplex_glossary.category_test_id.name" + parent = google_dataplex_glossary.category_test_id.name glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-basic%{random_suffix}" diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index 9f57c78d0015..1fbab7a6920f 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "google_dataplex_glossary.category_test_id.name" + parent = google_dataplex_glossary.category_test_id.name glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-full%{random_suffix}" From 3ba27145590f7ceda338811f410004fbb3699fa7 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 09:49:07 +0000 Subject: [PATCH 54/72] update parent name --- mmv1/products/dataplex/Category.yaml | 6 +++--- .../terraform/examples/dataplex_category_basic.tf.tmpl | 2 +- .../terraform/examples/dataplex_category_full.tf.tmpl | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/Category.yaml index 1fa484f614cc..6611b8c06cfa 100644 --- a/mmv1/products/dataplex/Category.yaml +++ b/mmv1/products/dataplex/Category.yaml @@ -22,9 +22,9 @@ update_verb: 'PATCH' update_mask: true delete_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' timeouts: - insert_minutes: 5 - update_minutes: 5 - delete_minutes: 5 + insert_minutes: 20 + update_minutes: 20 + delete_minutes: 20 autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'] async: diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index ee0304684f58..f04ae389ea15 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = google_dataplex_glossary.category_test_id.name + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id" glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-basic%{random_suffix}" diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index 1fbab7a6920f..75cdf3063047 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = google_dataplex_glossary.category_test_id.name + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id" glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-full%{random_suffix}" From e88c5708385e57a224aa8260e322e6f7e6950341 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 10:22:58 +0000 Subject: [PATCH 55/72] update parent --- .../terraform/examples/dataplex_category_basic.tf.tmpl | 10 +++++----- .../terraform/examples/dataplex_category_full.tf.tmpl | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index f04ae389ea15..ff8d6e38ea0e 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -1,11 +1,11 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { - glossary_id = "tf-test-glossary%{random_suffix}" - location = "us-central1" + glossary_id = "tf-test-glossary%{random_suffix}" + location = "us-central1" } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id" - glossary_id = google_dataplex_glossary.category_test_id.glossary_id - location = "us-central1" + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id + glossary_id = google_dataplex_glossary.category_test_id.glossary_id + location = "us-central1" category_id = "tf-test-category-basic%{random_suffix}" } diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index 75cdf3063047..592839cbac86 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id" + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-full%{random_suffix}" From 46add946a1289948c75f756ce1e2d1b194835ede Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 10:48:18 +0000 Subject: [PATCH 56/72] update parent --- .../terraform/examples/dataplex_category_basic.tf.tmpl | 2 +- .../templates/terraform/examples/dataplex_category_full.tf.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index ff8d6e38ea0e..9d284a7fe671 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-basic%{random_suffix}" diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index 592839cbac86..66f29242d92a 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/" + google_dataplex_glossary.category_test_id.glossary_id + parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-full%{random_suffix}" From 588f86aa001401c817d9241708858fb4ee8e36c9 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 11:12:38 +0000 Subject: [PATCH 57/72] updated parent --- .../terraform/examples/dataplex_category_basic.tf.tmpl | 2 +- .../templates/terraform/examples/dataplex_category_full.tf.tmpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl index 9d284a7fe671..1e6cb5fa0744 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" + parent = "projects/${google_dataplex_glossary.category_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-basic%{random_suffix}" diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index 66f29242d92a..6508a3d89a85 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -4,7 +4,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/{{index $.TestEnvVars "project_name"}}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" + parent = "projects/${google_dataplex_glossary.category_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" category_id = "tf-test-category-full%{random_suffix}" From 74094cdd5f67a89705f53715c62231854896ee61 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 12:08:35 +0000 Subject: [PATCH 58/72] update yaml --- mmv1/products/dataplex/Category.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/Category.yaml index 6611b8c06cfa..b508cee7d193 100644 --- a/mmv1/products/dataplex/Category.yaml +++ b/mmv1/products/dataplex/Category.yaml @@ -17,21 +17,21 @@ description: | base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories?category_id={{category_id}}' -update_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' +# update_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' update_verb: 'PATCH' update_mask: true -delete_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' +# delete_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' timeouts: - insert_minutes: 20 - update_minutes: 20 - delete_minutes: 20 + insert_minutes: 5 + update_minutes: 5 + delete_minutes: 5 autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'] -async: - actions: ['create', 'delete', 'update'] - type: 'OpAsync' - operation: - base_url: '{{op_id}}' +# async: +# actions: ['create', 'update'] +# type: 'OpSync' +# operation: +# base_url: '{{op_id}}' iam_policy: method_name_separator: ':' parent_resource_attribute: 'category_id' From 1c236532f5bef297c33213c56a8696372503fc09 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 13:13:41 +0000 Subject: [PATCH 59/72] update categoryId to full --- mmv1/products/dataplex/Category.yaml | 7 ------- .../terraform/examples/dataplex_category_full.tf.tmpl | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/Category.yaml index b508cee7d193..68e310351d70 100644 --- a/mmv1/products/dataplex/Category.yaml +++ b/mmv1/products/dataplex/Category.yaml @@ -17,21 +17,14 @@ description: | base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories?category_id={{category_id}}' -# update_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' update_verb: 'PATCH' update_mask: true -# delete_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' timeouts: insert_minutes: 5 update_minutes: 5 delete_minutes: 5 autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'] -# async: -# actions: ['create', 'update'] -# type: 'OpSync' -# operation: -# base_url: '{{op_id}}' iam_policy: method_name_separator: ':' parent_resource_attribute: 'category_id' diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl index 6508a3d89a85..2ddf1044097d 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl @@ -4,8 +4,8 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { } resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { - parent = "projects/${google_dataplex_glossary.category_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" - glossary_id = google_dataplex_glossary.category_test_id.glossary_id + parent = "projects/${google_dataplex_glossary.category_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id_full.glossary_id}" + glossary_id = google_dataplex_glossary.category_test_id_full.glossary_id location = "us-central1" category_id = "tf-test-category-full%{random_suffix}" From bfb8dac8cbf75b55f007d0628b100fbd45cf2f01 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 17:32:00 +0000 Subject: [PATCH 60/72] remove IAM --- mmv1/products/dataplex/Category.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/Category.yaml index 68e310351d70..ec791611810d 100644 --- a/mmv1/products/dataplex/Category.yaml +++ b/mmv1/products/dataplex/Category.yaml @@ -25,15 +25,6 @@ timeouts: delete_minutes: 5 autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'] -iam_policy: - method_name_separator: ':' - parent_resource_attribute: 'category_id' - import_format: - [ - 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}', - '{{category_id}}', - '{{glossary_id}}', - ] examples: - name: 'dataplex_category_basic' primary_resource_id: 'category_test_id' From c9fcc6a384d3f69edc130769638abbc8b8f49a07 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Tue, 13 May 2025 21:02:56 +0000 Subject: [PATCH 61/72] add support for term --- mmv1/products/dataplex/Term.yaml | 99 +++++++++++++++++++ .../examples/dataplex_term_basic.tf.tmpl | 11 +++ .../examples/dataplex_term_full.tf.tmpl | 15 +++ 3 files changed, 125 insertions(+) create mode 100644 mmv1/products/dataplex/Term.yaml create mode 100644 mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl create mode 100644 mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl diff --git a/mmv1/products/dataplex/Term.yaml b/mmv1/products/dataplex/Term.yaml new file mode 100644 index 000000000000..694d8b9cc235 --- /dev/null +++ b/mmv1/products/dataplex/Term.yaml @@ -0,0 +1,99 @@ +# 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: 'Term' +description: | + Represents a collection of terms within a Glossary that are related to each other. +base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}' +self_link: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}' +create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms?term_id={{term_id}}' +update_verb: 'PATCH' +update_mask: true +timeouts: + insert_minutes: 5 + update_minutes: 5 + delete_minutes: 5 +autogen_async: true +import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}'] +examples: + - name: 'dataplex_term_basic' + primary_resource_id: 'term_test_id' + primary_resource_name: 'fmt.Sprintf("tf-test-term-basic%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + vars: + term_name: 'term-basic' + - name: 'dataplex_term_full' + primary_resource_id: 'term_test_id_full' + primary_resource_name: 'fmt.Sprintf("tf-test-term-full%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' + vars: + term_name: 'term-full' +parameters: + - name: 'location' + type: String + description: | + The location where the glossary term should reside. + url_param_only: true + required: true + immutable: true + - name: 'glossaryId' + type: String + description: | + The glossary id for creation. + url_param_only: true + immutable: true + - name: 'termId' + type: String + description: | + The term id for creation. + url_param_only: true + immutable: true +properties: + - name: 'name' + type: String + description: | + The resource name of the GlossaryTerm. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/categories/{termId} + output: true + - name: 'displayName' + type: String + description: | + User friendly display name of the GlossaryTerm. This is user-mutable. This will be same as the termId, if not specified. + required: false + - name: 'description' + type: String + description: | + The user-mutable description of the GlossaryTerm. + required: false + - name: 'labels' + type: KeyValueLabels + description: | + User-defined labels for the GlossaryTerm. + required: false + - name: 'uid' + type: String + description: | + System generated unique id for the GlossaryTerm. This ID will be different if the GlossaryTerm is deleted and re-created with the same name. + output: true + - name: 'createTime' + type: Timestamp + description: | + The time at which the GlossaryTerm was created. + output: true + - name: 'updateTime' + type: Timestamp + description: | + The time at which the GlossaryTerm was last updated. + output: true + - name: 'parent' + type: String + description: | + The immediate parent of the GlossaryTerm in the resource-hierarchy. It can either be a Glossary or a Term. Format: projects/{projectId}/locations/{locationId}/glossaries/{glossaryId} OR projects/{projectId}/locations/{locationId}/glossaries/{glossaryId}/terms/{termId} + required: true diff --git a/mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl new file mode 100644 index 000000000000..b6520e2437e7 --- /dev/null +++ b/mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl @@ -0,0 +1,11 @@ +resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + glossary_id = "tf-test-glossary%{random_suffix}" + location = "us-central1" +} + +resource "google_dataplex_term" "{{$.PrimaryResourceId}}" { + parent = "projects/${google_dataplex_glossary.term_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id.glossary_id}" + glossary_id = google_dataplex_glossary.term_test_id.glossary_id + location = "us-central1" + term_id = "tf-test-term-basic%{random_suffix}" +} diff --git a/mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl new file mode 100644 index 000000000000..1359319164f6 --- /dev/null +++ b/mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl @@ -0,0 +1,15 @@ +resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { + glossary_id = "tf-test-glossary%{random_suffix}" + location = "us-central1" +} + +resource "google_dataplex_term" "{{$.PrimaryResourceId}}" { + parent = "projects/${google_dataplex_glossary.term_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id_full.glossary_id}" + glossary_id = google_dataplex_glossary.term_test_id_full.glossary_id + location = "us-central1" + term_id = "tf-test-term-full%{random_suffix}" + + labels = { "tag": "test-tf" } + display_name = "terraform term" + description = "term created by Terraform" +} From 89f8d27908e8bc39db04cae86e05bbde5e0ee118 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 15 May 2025 05:46:37 +0000 Subject: [PATCH 62/72] update term and category name --- mmv1/products/dataplex/{Category.yaml => GlossaryCategory.yaml} | 2 +- mmv1/products/dataplex/{Term.yaml => GlossaryTerm.yaml} | 2 +- ...y_basic.tf.tmpl => dataplex_glossary_category_basic.tf.tmpl} | 2 +- ...ory_full.tf.tmpl => dataplex_glossary_category_full.tf.tmpl} | 2 +- ..._term_basic.tf.tmpl => dataplex_glossary_term_basic.tf.tmpl} | 2 +- ...ex_term_full.tf.tmpl => dataplex_glossary_term_full.tf.tmpl} | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename mmv1/products/dataplex/{Category.yaml => GlossaryCategory.yaml} (99%) rename mmv1/products/dataplex/{Term.yaml => GlossaryTerm.yaml} (99%) rename mmv1/templates/terraform/examples/{dataplex_category_basic.tf.tmpl => dataplex_glossary_category_basic.tf.tmpl} (86%) rename mmv1/templates/terraform/examples/{dataplex_category_full.tf.tmpl => dataplex_glossary_category_full.tf.tmpl} (89%) rename mmv1/templates/terraform/examples/{dataplex_term_basic.tf.tmpl => dataplex_glossary_term_basic.tf.tmpl} (86%) rename mmv1/templates/terraform/examples/{dataplex_term_full.tf.tmpl => dataplex_glossary_term_full.tf.tmpl} (89%) diff --git a/mmv1/products/dataplex/Category.yaml b/mmv1/products/dataplex/GlossaryCategory.yaml similarity index 99% rename from mmv1/products/dataplex/Category.yaml rename to mmv1/products/dataplex/GlossaryCategory.yaml index ec791611810d..4561511ef706 100644 --- a/mmv1/products/dataplex/Category.yaml +++ b/mmv1/products/dataplex/GlossaryCategory.yaml @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 'Category' +name: 'GlossaryCategory' description: | Represents a collection of categories and terms within a Glossary that are related to each other. base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}' diff --git a/mmv1/products/dataplex/Term.yaml b/mmv1/products/dataplex/GlossaryTerm.yaml similarity index 99% rename from mmv1/products/dataplex/Term.yaml rename to mmv1/products/dataplex/GlossaryTerm.yaml index 694d8b9cc235..d4fb19991b75 100644 --- a/mmv1/products/dataplex/Term.yaml +++ b/mmv1/products/dataplex/GlossaryTerm.yaml @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 'Term' +name: 'GlossaryTerm' description: | Represents a collection of terms within a Glossary that are related to each other. base_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}' diff --git a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_category_basic.tf.tmpl similarity index 86% rename from mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl rename to mmv1/templates/terraform/examples/dataplex_glossary_category_basic.tf.tmpl index 1e6cb5fa0744..33603e802fb7 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_category_basic.tf.tmpl @@ -3,7 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { location = "us-central1" } -resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { +resource "google_dataplex_glossary_category" "{{$.PrimaryResourceId}}" { parent = "projects/${google_dataplex_glossary.category_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" glossary_id = google_dataplex_glossary.category_test_id.glossary_id location = "us-central1" diff --git a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_category_full.tf.tmpl similarity index 89% rename from mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl rename to mmv1/templates/terraform/examples/dataplex_glossary_category_full.tf.tmpl index 2ddf1044097d..2ead91ef0a47 100644 --- a/mmv1/templates/terraform/examples/dataplex_category_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_category_full.tf.tmpl @@ -3,7 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { location = "us-central1" } -resource "google_dataplex_category" "{{$.PrimaryResourceId}}" { +resource "google_dataplex_glossary_category" "{{$.PrimaryResourceId}}" { parent = "projects/${google_dataplex_glossary.category_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id_full.glossary_id}" glossary_id = google_dataplex_glossary.category_test_id_full.glossary_id location = "us-central1" diff --git a/mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_term_basic.tf.tmpl similarity index 86% rename from mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl rename to mmv1/templates/terraform/examples/dataplex_glossary_term_basic.tf.tmpl index b6520e2437e7..645cc127fb3f 100644 --- a/mmv1/templates/terraform/examples/dataplex_term_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_term_basic.tf.tmpl @@ -3,7 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { location = "us-central1" } -resource "google_dataplex_term" "{{$.PrimaryResourceId}}" { +resource "google_dataplex_glossary_term" "{{$.PrimaryResourceId}}" { parent = "projects/${google_dataplex_glossary.term_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id.glossary_id}" glossary_id = google_dataplex_glossary.term_test_id.glossary_id location = "us-central1" diff --git a/mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl b/mmv1/templates/terraform/examples/dataplex_glossary_term_full.tf.tmpl similarity index 89% rename from mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl rename to mmv1/templates/terraform/examples/dataplex_glossary_term_full.tf.tmpl index 1359319164f6..9fda7a3f31f2 100644 --- a/mmv1/templates/terraform/examples/dataplex_term_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/dataplex_glossary_term_full.tf.tmpl @@ -3,7 +3,7 @@ resource "google_dataplex_glossary" "{{$.PrimaryResourceId}}" { location = "us-central1" } -resource "google_dataplex_term" "{{$.PrimaryResourceId}}" { +resource "google_dataplex_glossary_term" "{{$.PrimaryResourceId}}" { parent = "projects/${google_dataplex_glossary.term_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id_full.glossary_id}" glossary_id = google_dataplex_glossary.term_test_id_full.glossary_id location = "us-central1" From de6ab99fb7b7402fc5c9eab768d8c9f94d7fec6a Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 15 May 2025 05:54:46 +0000 Subject: [PATCH 63/72] updated name --- mmv1/products/dataplex/GlossaryCategory.yaml | 4 ++-- mmv1/products/dataplex/GlossaryTerm.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/products/dataplex/GlossaryCategory.yaml b/mmv1/products/dataplex/GlossaryCategory.yaml index 4561511ef706..ef18993ae4d8 100644 --- a/mmv1/products/dataplex/GlossaryCategory.yaml +++ b/mmv1/products/dataplex/GlossaryCategory.yaml @@ -26,12 +26,12 @@ timeouts: autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'] examples: - - name: 'dataplex_category_basic' + - name: 'dataplex_glossary_category_basic' primary_resource_id: 'category_test_id' primary_resource_name: 'fmt.Sprintf("tf-test-category-basic%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: category_name: 'category-basic' - - name: 'dataplex_category_full' + - name: 'dataplex_glossary_category_full' primary_resource_id: 'category_test_id_full' primary_resource_name: 'fmt.Sprintf("tf-test-category-full%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: diff --git a/mmv1/products/dataplex/GlossaryTerm.yaml b/mmv1/products/dataplex/GlossaryTerm.yaml index d4fb19991b75..7eab9aa69c13 100644 --- a/mmv1/products/dataplex/GlossaryTerm.yaml +++ b/mmv1/products/dataplex/GlossaryTerm.yaml @@ -26,12 +26,12 @@ timeouts: autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}'] examples: - - name: 'dataplex_term_basic' + - name: 'dataplex_glossary_term_basic' primary_resource_id: 'term_test_id' primary_resource_name: 'fmt.Sprintf("tf-test-term-basic%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: term_name: 'term-basic' - - name: 'dataplex_term_full' + - name: 'dataplex_glossary_term_full' primary_resource_id: 'term_test_id_full' primary_resource_name: 'fmt.Sprintf("tf-test-term-full%s", context["random_suffix"]), fmt.Sprintf("tf-test-glossary%s", context["random_suffix"])' vars: From d8527f1028a23042bdcb65dbd1db9ec72d3850b6 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 15 May 2025 18:44:19 +0000 Subject: [PATCH 64/72] add update test --- ...ce_dataplex_glossary_category_test.go.tmpl | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl new file mode 100644 index 000000000000..d80a2f3e9a5f --- /dev/null +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl @@ -0,0 +1,99 @@ +package dataplex_test + +{{- if ne $.TargetVersionName "ga" }} + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/terraform" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" +) + +func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryBasicExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossaryCategory_update(context), + }, + { + ResourceName: "google_dataplex_glossary_category.category_test_id", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"category_id", "glossary_id", "labels", "location", "terraform_labels"}, + }, + }, + }) +} + +func testAccDataplexGlossaryCategory_update(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "category_test_id" { + glossary_id = "tf-test-glossary%{random_suffix}" + location = "us-central1" +} +resource "google_dataplex_glossary_category" "category_test_id" { + parent = "projects/${google_dataplex_glossary.category_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" + glossary_id = google_dataplex_glossary.category_test_id.glossary_id + location = "us-central1" + category_id = "tf-test-category-basic%{random_suffix}" +} +`, context) +} + +func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(context), + }, + { + ResourceName: "google_dataplex_glossary_category.category_test_id_full", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"category_id", "glossary_id", "labels", "location", "terraform_labels"}, + }, + }, + }) +} + +func testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "category_test_id_full" { + glossary_id = "tf-test-glossary%{random_suffix}" + location = "us-central1" +} +resource "google_dataplex_glossary_category" "category_test_id_full" { + parent = "projects/${google_dataplex_glossary.category_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id_full.glossary_id}" + glossary_id = google_dataplex_glossary.category_test_id_full.glossary_id + location = "us-central1" + category_id = "tf-test-category-full%{random_suffix}" + labels = { "tag": "test-tf" } + display_name = "terraform category" + description = "category created by Terraform" +} +`, context) +} + +{{- end }} \ No newline at end of file From 7306b018be0915dc9996e49dd34061dee117afed Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 15 May 2025 19:08:45 +0000 Subject: [PATCH 65/72] update test fixes --- ...source_dataplex_glossary_category_test.go.tmpl | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl index d80a2f3e9a5f..4d477605d724 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl @@ -3,19 +3,12 @@ package dataplex_test {{- if ne $.TargetVersionName "ga" }} import ( - "fmt" - "strings" "testing" - "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/terraform" - "github.com/hashicorp/terraform-provider-google/google/acctest" - "github.com/hashicorp/terraform-provider-google/google/tpgresource" - transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport" ) -func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryBasicExample(t *testing.T) { +func TestAccDataplexGlossaryCategory_update(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -54,7 +47,7 @@ resource "google_dataplex_glossary_category" "category_test_id" { `, context) } -func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(t *testing.T) { +func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryFull(t *testing.T) { t.Parallel() context := map[string]interface{}{ @@ -66,7 +59,7 @@ func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(t *test ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ { - Config: testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(context), + Config: testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFull(context), }, { ResourceName: "google_dataplex_glossary_category.category_test_id_full", @@ -78,7 +71,7 @@ func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(t *test }) } -func testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFullExample(context map[string]interface{}) string { +func testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFull(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_dataplex_glossary" "category_test_id_full" { glossary_id = "tf-test-glossary%{random_suffix}" From 00a39fb14c044c419b670727f875588d88faffa2 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Thu, 15 May 2025 19:34:17 +0000 Subject: [PATCH 66/72] add term update test --- ...source_dataplex_glossary_term_test.go.tmpl | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl new file mode 100644 index 000000000000..0eba37c63331 --- /dev/null +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl @@ -0,0 +1,92 @@ +package dataplex_test + +{{- if ne $.TargetVersionName "ga" }} + +import ( + "testing" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" +) + +func TestAccDataplexGlossaryTerm_update(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossaryTerm_update(context), + }, + { + ResourceName: "google_dataplex_glossary_term.term_test_id", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "term_id", "terraform_labels"}, + }, + }, + }) +} + +func testAccDataplexGlossaryTerm_update(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "term_test_id" { + glossary_id = "tf-test-glossary%{random_suffix}" + location = "us-central1" +} +resource "google_dataplex_glossary_term" "term_test_id" { + parent = "projects/${google_dataplex_glossary.term_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id.glossary_id}" + glossary_id = google_dataplex_glossary.term_test_id.glossary_id + location = "us-central1" + term_id = "tf-test-term-basic%{random_suffix}" +} +`, context) +} + +func TestAccDataplexGlossaryTerm_dataplexGlossaryTermFull(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossaryTerm_dataplexGlossaryTermFull(context), + }, + { + ResourceName: "google_dataplex_glossary_term.term_test_id_full", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "term_id", "terraform_labels"}, + }, + }, + }) +} + +func testAccDataplexGlossaryTerm_dataplexGlossaryTermFull(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_dataplex_glossary" "term_test_id_full" { + glossary_id = "tf-test-glossary%{random_suffix}" + location = "us-central1" +} +resource "google_dataplex_glossary_term" "term_test_id_full" { + parent = "projects/${google_dataplex_glossary.term_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id_full.glossary_id}" + glossary_id = google_dataplex_glossary.term_test_id_full.glossary_id + location = "us-central1" + term_id = "tf-test-term-full%{random_suffix}" + labels = { "tag": "test-tf" } + display_name = "terraform term" + description = "term created by Terraform" +} +`, context) +} + +{{- end }} From ca9f7b2ffc5ad4b455ded3544f445bb766abdfad Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 16 May 2025 05:19:29 +0000 Subject: [PATCH 67/72] refactor tests --- ...ce_dataplex_glossary_category_test.go.tmpl | 56 ++++++++----------- ...source_dataplex_glossary_term_test.go.tmpl | 55 ++++++++---------- 2 files changed, 44 insertions(+), 67 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl index 4d477605d724..4f64ed10571c 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl @@ -1,11 +1,12 @@ package dataplex_test -{{- if ne $.TargetVersionName "ga" }} - import ( "testing" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-plugin-testing/plancheck" ) func TestAccDataplexGlossaryCategory_update(t *testing.T) { @@ -19,58 +20,47 @@ func TestAccDataplexGlossaryCategory_update(t *testing.T) { PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFull(context), + }, + { + ResourceName: "google_dataplex_glossary_category.category_test_id_full", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"category_id", "glossary_id", "labels", "location", "terraform_labels"}, + }, { Config: testAccDataplexGlossaryCategory_update(context), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("google_dataplex_glossary_category.category_test_id_full", plancheck.ResourceActionUpdate), + }, + }, }, { - ResourceName: "google_dataplex_glossary_category.category_test_id", + ResourceName: "google_dataplex_glossary_category.category_test_id_full", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"category_id", "glossary_id", "labels", "location", "terraform_labels"}, }, }, }) -} func testAccDataplexGlossaryCategory_update(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_dataplex_glossary" "category_test_id" { +resource "google_dataplex_glossary" "category_test_id_full" { glossary_id = "tf-test-glossary%{random_suffix}" location = "us-central1" } -resource "google_dataplex_glossary_category" "category_test_id" { - parent = "projects/${google_dataplex_glossary.category_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id.glossary_id}" - glossary_id = google_dataplex_glossary.category_test_id.glossary_id +resource "google_dataplex_glossary_category" "category_test_id_full" { + parent = "projects/${google_dataplex_glossary.category_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id_full.glossary_id}" + glossary_id = google_dataplex_glossary.category_test_id_full.glossary_id location = "us-central1" category_id = "tf-test-category-basic%{random_suffix}" } `, context) } -func TestAccDataplexGlossaryCategory_dataplexGlossaryCategoryFull(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFull(context), - }, - { - ResourceName: "google_dataplex_glossary_category.category_test_id_full", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"category_id", "glossary_id", "labels", "location", "terraform_labels"}, - }, - }, - }) -} - func testAccDataplexGlossaryCategory_dataplexGlossaryCategoryFull(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_dataplex_glossary" "category_test_id_full" { @@ -88,5 +78,3 @@ resource "google_dataplex_glossary_category" "category_test_id_full" { } `, context) } - -{{- end }} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl index 0eba37c63331..1f13e7fa1d05 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl @@ -1,11 +1,12 @@ package dataplex_test -{{- if ne $.TargetVersionName "ga" }} - import ( "testing" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-plugin-testing/plancheck" ) func TestAccDataplexGlossaryTerm_update(t *testing.T) { @@ -19,11 +20,25 @@ func TestAccDataplexGlossaryTerm_update(t *testing.T) { PreCheck: func() { acctest.AccTestPreCheck(t) }, ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), Steps: []resource.TestStep{ + { + Config: testAccDataplexGlossaryTerm_dataplexGlossaryTermFull(context), + }, + { + ResourceName: "google_dataplex_glossary_term.term_test_id_full", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "term_id", "terraform_labels"}, + }, { Config: testAccDataplexGlossaryTerm_update(context), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("google_dataplex_glossary_term.term_test_id_full", plancheck.ResourceActionUpdate), + }, + }, }, { - ResourceName: "google_dataplex_glossary_term.term_test_id", + ResourceName: "google_dataplex_glossary_term.term_test_id_full", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "term_id", "terraform_labels"}, @@ -34,43 +49,19 @@ func TestAccDataplexGlossaryTerm_update(t *testing.T) { func testAccDataplexGlossaryTerm_update(context map[string]interface{}) string { return acctest.Nprintf(` -resource "google_dataplex_glossary" "term_test_id" { +resource "google_dataplex_glossary" "term_test_id_full" { glossary_id = "tf-test-glossary%{random_suffix}" location = "us-central1" } -resource "google_dataplex_glossary_term" "term_test_id" { - parent = "projects/${google_dataplex_glossary.term_test_id.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id.glossary_id}" - glossary_id = google_dataplex_glossary.term_test_id.glossary_id +resource "google_dataplex_glossary_term" "term_test_id_full" { + parent = "projects/${google_dataplex_glossary.term_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id_full.glossary_id}" + glossary_id = google_dataplex_glossary.term_test_id_full.glossary_id location = "us-central1" term_id = "tf-test-term-basic%{random_suffix}" } `, context) } -func TestAccDataplexGlossaryTerm_dataplexGlossaryTermFull(t *testing.T) { - t.Parallel() - - context := map[string]interface{}{ - "random_suffix": acctest.RandString(t, 10), - } - - acctest.VcrTest(t, resource.TestCase{ - PreCheck: func() { acctest.AccTestPreCheck(t) }, - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), - Steps: []resource.TestStep{ - { - Config: testAccDataplexGlossaryTerm_dataplexGlossaryTermFull(context), - }, - { - ResourceName: "google_dataplex_glossary_term.term_test_id_full", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"glossary_id", "labels", "location", "term_id", "terraform_labels"}, - }, - }, - }) -} - func testAccDataplexGlossaryTerm_dataplexGlossaryTermFull(context map[string]interface{}) string { return acctest.Nprintf(` resource "google_dataplex_glossary" "term_test_id_full" { @@ -88,5 +79,3 @@ resource "google_dataplex_glossary_term" "term_test_id_full" { } `, context) } - -{{- end }} From 04e35be9b92dec2e48ae3dd63720176bf202a675 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 16 May 2025 05:46:14 +0000 Subject: [PATCH 68/72] minor fix --- .../dataplex/resource_dataplex_glossary_category_test.go.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl index 4f64ed10571c..43825a618c98 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl @@ -45,6 +45,7 @@ func TestAccDataplexGlossaryCategory_update(t *testing.T) { }, }, }) +} func testAccDataplexGlossaryCategory_update(context map[string]interface{}) string { return acctest.Nprintf(` From 8e2d10fb295a6524740f5c7dc2e3eed760346ead Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 16 May 2025 05:49:13 +0000 Subject: [PATCH 69/72] update file type --- ...y_test.go.tmpl => resource_dataplex_glossary_category_test.go} | 0 ..._term_test.go.tmpl => resource_dataplex_glossary_term_test.go} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename mmv1/third_party/terraform/services/dataplex/{resource_dataplex_glossary_category_test.go.tmpl => resource_dataplex_glossary_category_test.go} (100%) rename mmv1/third_party/terraform/services/dataplex/{resource_dataplex_glossary_term_test.go.tmpl => resource_dataplex_glossary_term_test.go} (100%) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go similarity index 100% rename from mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go.tmpl rename to mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go similarity index 100% rename from mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go.tmpl rename to mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go From c8e932ae2b659a3defd388068c2498820cb02048 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 16 May 2025 05:55:48 +0000 Subject: [PATCH 70/72] format fix --- .../dataplex/resource_dataplex_glossary_category_test.go | 2 +- .../services/dataplex/resource_dataplex_glossary_term_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go index 43825a618c98..3ea24b463eea 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go @@ -5,8 +5,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccDataplexGlossaryCategory_update(t *testing.T) { diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go index 1f13e7fa1d05..4f8cacc27ee6 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go @@ -5,8 +5,8 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-provider-google/google/acctest" "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-provider-google/google/acctest" ) func TestAccDataplexGlossaryTerm_update(t *testing.T) { From 45a13ee2a8c0892dfbc4f97b5088f24e43b7dcc1 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 16 May 2025 06:25:07 +0000 Subject: [PATCH 71/72] update id --- .../dataplex/resource_dataplex_glossary_category_test.go | 4 +++- .../services/dataplex/resource_dataplex_glossary_term_test.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go index 3ea24b463eea..863fedcb8570 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_category_test.go @@ -57,7 +57,9 @@ resource "google_dataplex_glossary_category" "category_test_id_full" { parent = "projects/${google_dataplex_glossary.category_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.category_test_id_full.glossary_id}" glossary_id = google_dataplex_glossary.category_test_id_full.glossary_id location = "us-central1" - category_id = "tf-test-category-basic%{random_suffix}" + category_id = "tf-test-category-full%{random_suffix}" + display_name = "terraform category updated" + description = "category updated by Terraform" } `, context) } diff --git a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go index 4f8cacc27ee6..557297d051e6 100644 --- a/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go +++ b/mmv1/third_party/terraform/services/dataplex/resource_dataplex_glossary_term_test.go @@ -57,7 +57,9 @@ resource "google_dataplex_glossary_term" "term_test_id_full" { parent = "projects/${google_dataplex_glossary.term_test_id_full.project}/locations/us-central1/glossaries/${google_dataplex_glossary.term_test_id_full.glossary_id}" glossary_id = google_dataplex_glossary.term_test_id_full.glossary_id location = "us-central1" - term_id = "tf-test-term-basic%{random_suffix}" + term_id = "tf-test-term-full%{random_suffix}" + display_name = "terraform term updated" + description = "term created by Terraform updated" } `, context) } From db3e42ec473d44e992a6800becd4bcdefffad499 Mon Sep 17 00:00:00 2001 From: Sachin Rungta Date: Fri, 16 May 2025 07:00:30 +0000 Subject: [PATCH 72/72] increase timeouts --- mmv1/products/dataplex/Glossary.yaml | 6 +++--- mmv1/products/dataplex/GlossaryCategory.yaml | 6 +++--- mmv1/products/dataplex/GlossaryTerm.yaml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mmv1/products/dataplex/Glossary.yaml b/mmv1/products/dataplex/Glossary.yaml index a47c435ee8ca..ab539228dc4c 100644 --- a/mmv1/products/dataplex/Glossary.yaml +++ b/mmv1/products/dataplex/Glossary.yaml @@ -20,9 +20,9 @@ create_url: 'projects/{{project}}/locations/{{location}}/glossaries?glossary_id= update_verb: 'PATCH' update_mask: true timeouts: - insert_minutes: 5 - update_minutes: 5 - delete_minutes: 5 + insert_minutes: 15 + update_minutes: 15 + delete_minutes: 15 autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}'] async: diff --git a/mmv1/products/dataplex/GlossaryCategory.yaml b/mmv1/products/dataplex/GlossaryCategory.yaml index ef18993ae4d8..9a8b13dbcbf1 100644 --- a/mmv1/products/dataplex/GlossaryCategory.yaml +++ b/mmv1/products/dataplex/GlossaryCategory.yaml @@ -20,9 +20,9 @@ create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_i update_verb: 'PATCH' update_mask: true timeouts: - insert_minutes: 5 - update_minutes: 5 - delete_minutes: 5 + insert_minutes: 15 + update_minutes: 15 + delete_minutes: 15 autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/categories/{{category_id}}'] examples: diff --git a/mmv1/products/dataplex/GlossaryTerm.yaml b/mmv1/products/dataplex/GlossaryTerm.yaml index 7eab9aa69c13..e133549ed345 100644 --- a/mmv1/products/dataplex/GlossaryTerm.yaml +++ b/mmv1/products/dataplex/GlossaryTerm.yaml @@ -20,9 +20,9 @@ create_url: 'projects/{{project}}/locations/{{location}}/glossaries/{{glossary_i update_verb: 'PATCH' update_mask: true timeouts: - insert_minutes: 5 - update_minutes: 5 - delete_minutes: 5 + insert_minutes: 15 + update_minutes: 15 + delete_minutes: 15 autogen_async: true import_format: ['projects/{{project}}/locations/{{location}}/glossaries/{{glossary_id}}/terms/{{term_id}}'] examples: