Skip to content

Commit a124148

Browse files
bcreddy-gcpanoopkverma-google
authored andcommitted
Colab runtime template (GoogleCloudPlatform#12706)
1 parent 9d8b77a commit a124148

File tree

8 files changed

+298
-0
lines changed

8 files changed

+298
-0
lines changed
+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
16+
name: 'RuntimeTemplate'
17+
description: |
18+
'A runtime template is a VM configuration that specifies a machine type and other characteristics of the VM,
19+
as well as common settings such as the network and whether public internet access is enabled. When you create
20+
a runtime, its VM is created according to the specifications of a runtime template.'
21+
22+
references:
23+
guides:
24+
'Create a runtime template': 'https://cloud.google.com/colab/docs/create-runtime-template'
25+
api: 'https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.notebookRuntimeTemplates'
26+
base_url: 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates'
27+
self_link: 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates/{{name}}'
28+
immutable: true
29+
create_url: 'projects/{{project}}/locations/{{location}}/notebookRuntimeTemplates?notebook_runtime_template_id={{name}}'
30+
autogen_async: true
31+
async:
32+
operation:
33+
base_url: '{{op_id}}'
34+
custom_code:
35+
post_create: 'templates/terraform/post_create/colab_runtime_template.tmpl'
36+
examples:
37+
- name: 'colab_runtime_template_basic'
38+
primary_resource_id: 'runtime-template'
39+
primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime-template%s", context["random_suffix"])'
40+
vars:
41+
runtime_template_name: 'colab-runtime-template'
42+
- name: 'colab_runtime_template_no_name'
43+
primary_resource_id: 'runtime-template'
44+
exclude_import_test: true
45+
- name: 'colab_runtime_template_full'
46+
primary_resource_id: 'runtime-template'
47+
primary_resource_name: 'fmt.Sprintf("tf-test-colab-runtime-template%s", context["random_suffix"])'
48+
vars:
49+
runtime_template_name: 'colab-runtime-template'
50+
network_name: 'colab-test-default'
51+
key_name: 'my-crypto-key'
52+
test_vars_overrides:
53+
key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name'
54+
parameters:
55+
- name: 'location'
56+
type: String
57+
required: true
58+
url_param_only: true
59+
description: 'The location for the resource: https://cloud.google.com/colab/docs/locations'
60+
properties:
61+
- name: 'name'
62+
type: String
63+
default_from_api: true
64+
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.tmpl'
65+
description: 'The resource name of the Runtime Template'
66+
- name: 'displayName'
67+
type: String
68+
description:
69+
Required. The display name of the Runtime Template.
70+
required: true
71+
- name: description
72+
type: String
73+
description: 'The description of the Runtime Template.'
74+
- name: machineSpec
75+
type: NestedObject
76+
default_from_api: true
77+
description: |
78+
'The machine configuration of the runtime.'
79+
properties:
80+
- name: 'machineType'
81+
type: string
82+
default_from_api: true
83+
description: |
84+
The Compute Engine machine type selected for the runtime.
85+
- name: 'acceleratorType'
86+
type: enum
87+
description: |
88+
The type of hardware accelerator used by the runtime. If specified, acceleratorCount must also be specified.
89+
enum_values:
90+
- 'NVIDIA_TESLA_V100'
91+
- 'NVIDIA_TESLA_T4'
92+
- 'NVIDIA_TESLA_A100'
93+
- 'NVIDIA_A100_80GB'
94+
- 'NVIDIA_L4'
95+
- name: 'acceleratorCount'
96+
type: Integer
97+
default_from_api: true
98+
description: 'The number of accelerators used by the runtime.'
99+
- name: dataPersistentDiskSpec
100+
default_from_api: true
101+
type: NestedObject
102+
description: 'The configuration for the data disk of the runtime.'
103+
properties:
104+
- name: 'diskType'
105+
type: enum
106+
description: 'The type of the persistent disk.'
107+
default_from_api: true
108+
enum_values:
109+
- 'pd-standard'
110+
- 'pd-ssd'
111+
- 'pd-balanced'
112+
- 'pd-extreme'
113+
- name: 'diskSizeGb'
114+
type: int
115+
default_from_api: true
116+
description: |
117+
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.
118+
- name: networkSpec
119+
type: NestedObject
120+
default_from_api: true
121+
description: 'The network configuration for the runtime.'
122+
properties:
123+
- name: 'enableInternetAccess'
124+
type: Boolean
125+
description: Enable public internet access for the runtime.
126+
- name: 'network'
127+
default_from_api: true
128+
type: String
129+
description: 'The name of the VPC that this runtime is in.'
130+
diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths'
131+
- name: 'subnetwork'
132+
type: String
133+
description: 'The name of the subnetwork that this runtime is in.'
134+
diff_suppress_func: 'tpgresource.CompareSelfLinkRelativePaths'
135+
- name: 'labels'
136+
type: KeyValueLabels
137+
description: 'Labels to identify and group the runtime template.'
138+
- name: idleShutdownConfig
139+
type: NestedObject
140+
default_from_api: true
141+
description: 'Notebook Idle Shutdown configuration for the runtime.'
142+
properties:
143+
- name: 'idleTimeout'
144+
default_from_api: true
145+
type: String
146+
description: 'The duration after which the runtime is automatically shut down. An input of 0s disables the idle shutdown feature, and a valid range is [10m, 24h].'
147+
- name: eucConfig
148+
type: NestedObject
149+
description: 'EUC configuration of the NotebookRuntimeTemplate.'
150+
properties:
151+
- name: 'eucDisabled'
152+
type: Boolean
153+
description: 'Disable end user credential access for the runtime.'
154+
- name: shieldedVmConfig
155+
type: NestedObject
156+
description: 'Runtime Shielded VM spec.'
157+
properties:
158+
- name: 'enableSecureBoot'
159+
type: Boolean
160+
description: 'Enables secure boot for the runtime.'
161+
- name: 'networkTags'
162+
type: Array
163+
item_type:
164+
type: String
165+
description: 'Applies the given Compute Engine tags to the runtime.'
166+
- name: encryptionSpec
167+
type: NestedObject
168+
description: 'Customer-managed encryption key spec for the notebook runtime.'
169+
properties:
170+
- name: 'kmsKeyName'
171+
type: String
172+
description: 'The Cloud KMS encryption key (customer-managed encryption key) used to protect the runtime.'

mmv1/products/colab/product.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: 'Colab'
16+
display_name: 'Colab Enterprise'
17+
versions:
18+
- name: 'ga'
19+
base_url: 'https://{{region}}-aiplatform.googleapis.com/v1/'
20+
cai_base_url: 'https://aiplatform.googleapis.com/v1/'
21+
- name: 'beta'
22+
base_url: 'https://{{region}}-aiplatform.googleapis.com/v1beta1/'
23+
cai_base_url: 'https://aiplatform.googleapis.com/v1beta1/'
24+
scopes:
25+
- 'https://www.googleapis.com/auth/cloud-platform'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
resource "google_colab_runtime_template" "{{$.PrimaryResourceId}}" {
2+
name = "{{index $.Vars "runtime_template_name"}}"
3+
display_name = "Runtime template basic"
4+
location = "us-central1"
5+
6+
machine_spec {
7+
machine_type = "e2-standard-4"
8+
}
9+
10+
network_spec {
11+
enable_internet_access = true
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
resource "google_compute_network" "my_network" {
2+
name = "{{index $.Vars "network_name"}}"
3+
auto_create_subnetworks = false
4+
}
5+
6+
resource "google_compute_subnetwork" "my_subnetwork" {
7+
name = "{{index $.Vars "network_name"}}"
8+
network = google_compute_network.my_network.id
9+
region = "us-central1"
10+
ip_cidr_range = "10.0.1.0/24"
11+
}
12+
13+
resource "google_colab_runtime_template" "{{$.PrimaryResourceId}}" {
14+
name = "{{index $.Vars "runtime_template_name"}}"
15+
display_name = "Runtime template full"
16+
location = "us-central1"
17+
description = "Full runtime template"
18+
machine_spec {
19+
machine_type = "n1-standard-2"
20+
accelerator_type = "NVIDIA_TESLA_T4"
21+
accelerator_count = "1"
22+
}
23+
24+
data_persistent_disk_spec {
25+
disk_type = "pd-standard"
26+
disk_size_gb = 200
27+
}
28+
29+
network_spec {
30+
enable_internet_access = true
31+
network = google_compute_network.my_network.id
32+
subnetwork = google_compute_subnetwork.my_subnetwork.id
33+
}
34+
35+
labels = {
36+
k = "val"
37+
}
38+
39+
idle_shutdown_config {
40+
idle_timeout = "3600s"
41+
}
42+
43+
euc_config {
44+
euc_disabled = true
45+
}
46+
47+
shielded_vm_config {
48+
enable_secure_boot = true
49+
}
50+
51+
network_tags = ["abc", "def"]
52+
53+
encryption_spec {
54+
kms_key_name = "{{index $.Vars "key_name"}}"
55+
}
56+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resource "google_colab_runtime_template" "{{$.PrimaryResourceId}}" {
2+
display_name = "Runtime template no name"
3+
location = "us-central1"
4+
5+
machine_spec {
6+
machine_type = "e2-standard-4"
7+
}
8+
9+
network_spec {
10+
enable_internet_access = true
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// The operation for this resource contains the generated name that we need
2+
// in order to perform a READ. We need to access the object inside of it as
3+
// a map[string]interface, so let's do that.
4+
5+
resp := res["response"].(map[string]interface{})
6+
name := tpgresource.GetResourceNameFromSelfLink(resp["name"].(string))
7+
log.Printf("[DEBUG] Setting resource name, id to %s", name)
8+
if err := d.Set("name", name); err != nil {
9+
return fmt.Errorf("Error setting name: %s", err)
10+
}

mmv1/third_party/terraform/.teamcity/components/inputs/services_beta.kt

+5
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ var ServicesListBeta = mapOf(
216216
"displayName" to "Cloudtasks",
217217
"path" to "./google-beta/services/cloudtasks"
218218
),
219+
"colab" to mapOf(
220+
"name" to "colab",
221+
"displayName" to "Colab",
222+
"path" to "./google-beta/services/colab"
223+
),
219224
"composer" to mapOf(
220225
"name" to "composer",
221226
"displayName" to "Composer",

mmv1/third_party/terraform/.teamcity/components/inputs/services_ga.kt

+5
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ var ServicesListGa = mapOf(
216216
"displayName" to "Cloudtasks",
217217
"path" to "./google/services/cloudtasks"
218218
),
219+
"colab" to mapOf(
220+
"name" to "colab",
221+
"displayName" to "Colab",
222+
"path" to "./google/services/colab"
223+
),
219224
"composer" to mapOf(
220225
"name" to "composer",
221226
"displayName" to "Composer",

0 commit comments

Comments
 (0)