From 206748b72ec2830ab5003af1b343cbfea275b2f0 Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Wed, 8 Jan 2025 19:37:25 +0000 Subject: [PATCH 1/8] fix colab test --- .../terraform/examples/colab_runtime_template_full.tf.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/templates/terraform/examples/colab_runtime_template_full.tf.tmpl b/mmv1/templates/terraform/examples/colab_runtime_template_full.tf.tmpl index 9c09e7b78fa8..3078041236d9 100644 --- a/mmv1/templates/terraform/examples/colab_runtime_template_full.tf.tmpl +++ b/mmv1/templates/terraform/examples/colab_runtime_template_full.tf.tmpl @@ -10,7 +10,7 @@ resource "google_compute_subnetwork" "my_subnetwork" { ip_cidr_range = "10.0.1.0/24" } -resource "google_colab_runtime_template" "default" { +resource "google_colab_runtime_template" "{{$.PrimaryResourceId}}" { name = "{{index $.Vars "runtime_template_name"}}" display_name = "Runtime template full" location = "us-central1" From 01d38f39e626630ba19b8fce19b6b8ef394ebaee Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Wed, 8 Jan 2025 19:42:48 +0000 Subject: [PATCH 2/8] fix teamcity tests --- .../terraform/.teamcity/components/inputs/services_beta.kt | 5 +++++ .../terraform/.teamcity/components/inputs/services_ga.kt | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt index 24abf96b5b4f..6f570a3f2e42 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt @@ -216,6 +216,11 @@ var ServicesListBeta = mapOf( "displayName" to "Cloudtasks", "path" to "./google-beta/services/cloudtasks" ), + "colab" to mapOf( + "name" to "colab", + "displayName" to "Colab", + "path" to "./google-beta/services/colab" + ), "composer" to mapOf( "name" to "composer", "displayName" to "Composer", diff --git a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt index a5bb12bca8f1..5acb4430314c 100644 --- a/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt +++ b/mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt @@ -216,6 +216,11 @@ var ServicesListGa = mapOf( "displayName" to "Cloudtasks", "path" to "./google/services/cloudtasks" ), + "colab" to mapOf( + "name" to "colab", + "displayName" to "Colab", + "path" to "./google/services/colab" + ), "composer" to mapOf( "name" to "composer", "displayName" to "Composer", From 28d57e14ccf068ac40a432d3bc9a40f4fa5da4b5 Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Wed, 8 Jan 2025 20:28:46 +0000 Subject: [PATCH 3/8] keep TF consistent with API --- mmv1/products/colab/RuntimeTemplate.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml index c95542b54ba8..5cdbd2ebe217 100644 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ b/mmv1/products/colab/RuntimeTemplate.yaml @@ -61,7 +61,6 @@ properties: - name: 'name' type: String url_param_only: true - required: true description: 'The resource name of the Runtime Template' - name: 'displayName' type: String @@ -77,7 +76,6 @@ properties: 'The machine configuration of the runtime.' properties: - name: 'machineType' - required: true type: string description: | The Compute Engine machine type selected for the runtime. @@ -114,7 +112,6 @@ properties: The disk size of the runtime in GB. If specified, the diskType must also be specified. The minimum size is 10GB and the maximum is 65536GB. - name: networkSpec type: NestedObject - required: true description: 'The network configuration for the runtime.' properties: - name: 'enableInternetAccess' From 78bfb4b6a0be4a19e621224ab826508633f490a1 Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Thu, 9 Jan 2025 00:26:04 +0000 Subject: [PATCH 4/8] Move name to parameters --- mmv1/products/colab/RuntimeTemplate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml index 5cdbd2ebe217..1b2ab37145ef 100644 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ b/mmv1/products/colab/RuntimeTemplate.yaml @@ -57,11 +57,11 @@ parameters: required: true url_param_only: true description: 'The location for the resource: https://cloud.google.com/colab/docs/locations' -properties: - name: 'name' type: String url_param_only: true description: 'The resource name of the Runtime Template' +properties: - name: 'displayName' type: String description: From 1eb0c285e02eb6560da982be763a072fcf968cab Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Thu, 9 Jan 2025 00:46:25 +0000 Subject: [PATCH 5/8] remove unnecessary variables --- mmv1/products/colab/RuntimeTemplate.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml index 1b2ab37145ef..37eb5234d3ba 100644 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ b/mmv1/products/colab/RuntimeTemplate.yaml @@ -48,7 +48,6 @@ examples: key_name: 'my-crypto-key' test_env_vars: project_id: 'PROJECT_NAME' - service_account: 'SERVICE_ACCT' test_vars_overrides: key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' parameters: From beb9849bdcf2e4ee9bf4f2a31b6345b9c9893df4 Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Thu, 9 Jan 2025 02:15:55 +0000 Subject: [PATCH 6/8] Another unused var --- mmv1/products/colab/RuntimeTemplate.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml index 37eb5234d3ba..f381192d3452 100644 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ b/mmv1/products/colab/RuntimeTemplate.yaml @@ -46,8 +46,6 @@ examples: runtime_template_name: 'colab-runtime-template' network_name: 'colab-test-default' key_name: 'my-crypto-key' - test_env_vars: - project_id: 'PROJECT_NAME' test_vars_overrides: key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name' parameters: From 90a9a24e82831a4fe00d6bad8b7e5b3f5c8b9c4b Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Thu, 9 Jan 2025 20:40:02 +0000 Subject: [PATCH 7/8] Add no name test --- mmv1/products/colab/RuntimeTemplate.yaml | 5 +++++ .../examples/colab_runtime_template_no_name.tf.tmpl | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 mmv1/templates/terraform/examples/colab_runtime_template_no_name.tf.tmpl diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml index f381192d3452..08f71b4c9e12 100644 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ b/mmv1/products/colab/RuntimeTemplate.yaml @@ -38,6 +38,10 @@ examples: region_override: 'us-central1' vars: runtime_template_name: 'colab-runtime-template' + - name: 'colab_runtime_template_no_name' + primary_resource_id: 'runtime-template' + region_override: 'us-central1' + exclude_import_test: true - name: 'colab_runtime_template_full' primary_resource_id: 'runtime-template' primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime-template%s", context["random_suffix"])' @@ -57,6 +61,7 @@ parameters: - name: 'name' type: String url_param_only: true + default_from_api: true description: 'The resource name of the Runtime Template' properties: - name: 'displayName' diff --git a/mmv1/templates/terraform/examples/colab_runtime_template_no_name.tf.tmpl b/mmv1/templates/terraform/examples/colab_runtime_template_no_name.tf.tmpl new file mode 100644 index 000000000000..51dff7ab02cc --- /dev/null +++ b/mmv1/templates/terraform/examples/colab_runtime_template_no_name.tf.tmpl @@ -0,0 +1,12 @@ +resource "google_colab_runtime_template" "{{$.PrimaryResourceId}}" { + display_name = "Runtime template no name" + location = "us-central1" + + machine_spec { + machine_type = "e2-standard-4" + } + + network_spec { + enable_internet_access = true + } +} From 2f4a67c0d9350f972d29e641a23c9d11b23575b7 Mon Sep 17 00:00:00 2001 From: Bhargav Chereddy Date: Thu, 9 Jan 2025 22:22:22 +0000 Subject: [PATCH 8/8] Added default_from_api to necessary fields --- mmv1/products/colab/RuntimeTemplate.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mmv1/products/colab/RuntimeTemplate.yaml b/mmv1/products/colab/RuntimeTemplate.yaml index 08f71b4c9e12..256a47481a68 100644 --- a/mmv1/products/colab/RuntimeTemplate.yaml +++ b/mmv1/products/colab/RuntimeTemplate.yaml @@ -74,6 +74,7 @@ properties: description: 'The description of the Runtime Template.' - name: machineSpec type: NestedObject + default_from_api: true description: | 'The machine configuration of the runtime.' properties: @@ -93,7 +94,6 @@ properties: - 'NVIDIA_L4' - name: 'acceleratorCount' type: Integer - default_from_api: true description: 'The number of accelerators used by the runtime.' - name: dataPersistentDiskSpec type: NestedObject @@ -114,6 +114,7 @@ properties: The disk size of the runtime in GB. If specified, the diskType must also be specified. The minimum size is 10GB and the maximum is 65536GB. - name: networkSpec type: NestedObject + default_from_api: true description: 'The network configuration for the runtime.' properties: - name: 'enableInternetAccess' @@ -122,12 +123,10 @@ properties: - name: 'network' type: String description: 'The name of the VPC that this runtime is in.' - default_from_api: true diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths' - name: 'subnetwork' type: String - description: 'The name of the VPC that this runtime is in.' - default_from_api: true + description: 'The name of the subnetwork that this runtime is in.' diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths' - name: 'labels' type: KeyValueLabels @@ -146,7 +145,7 @@ properties: properties: - name: 'eucDisabled' type: Boolean - description: 'Enable end user credential access for the runtime.' + description: 'Disable end user credential access for the runtime.' - name: shieldedVmConfig type: NestedObject description: 'Runtime Shielded VM spec.'