Skip to content

Commit

Permalink
Add support for custom containers for workbench instances (#9973)
Browse files Browse the repository at this point in the history
* Add support for custom containers for workbench instances

* Use conflicts instead of exactly_one_of for backward compatibility
  • Loading branch information
bcreddy-gcp authored Feb 20, 2024
1 parent 4b1359d commit aeba6c4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mmv1/products/workbench/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ examples:
region_override: 'us-west1-a'
vars:
instance_name: 'workbench-instance'
- !ruby/object:Provider::Terraform::Examples
name: 'workbench_instance_basic_container'
primary_resource_id: 'instance'
primary_resource_name: "fmt.Sprintf(\"tf-test-workbench-instance%s\",
context[\"\
random_suffix\"])"
region_override: 'us-west1-a'
vars:
instance_name: 'workbench-instance'
- !ruby/object:Provider::Terraform::Examples
name: 'workbench_instance_basic_gpu'
primary_resource_id: 'instance'
Expand Down Expand Up @@ -213,6 +222,8 @@ properties:
name: vmImage
custom_flatten: templates/terraform/custom_flatten/workbench_instance_vm_image_flatten.go.erb
default_from_api: true
conflicts:
- gce_setup.0.container_image
immutable: true
description: |
Definition of a custom Compute Engine virtual machine image for starting
Expand Down Expand Up @@ -240,6 +251,23 @@ properties:
exactly_one_of:
- vm_image.0.name
- vm_image.0.family
- !ruby/object:Api::Type::NestedObject
name: containerImage
conflicts:
- gce_setup.0.vm_image
description: |
Use a container image to start the workbench instance.
properties:
- !ruby/object:Api::Type::String
name: 'repository'
description: |
The path to the container image repository.
For example: gcr.io/{project_id}/{imageName}
required: true
- !ruby/object:Api::Type::String
name: 'tag'
description: |
The tag of the container image. If not specified, this defaults to the latest tag.
- !ruby/object:Api::Type::NestedObject
name: bootDisk
default_from_api: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "google_workbench_instance" "<%= ctx[:primary_resource_id] %>" {
name = "<%= ctx[:vars]['instance_name'] %>"
location = "us-west1-a"

gce_setup {
container_image {
repository = "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/base-cu113.py310"
tag = "latest"
}
}
}

0 comments on commit aeba6c4

Please sign in to comment.