Skip to content

Commit

Permalink
feat(compute): Instance Template with GPUs example (#534)
Browse files Browse the repository at this point in the history
* Added example for Zonal MIGs

* Update compute/zonal_instance_group_manager/main.tf

Co-authored-by: Sampath Kumar <[email protected]>

* Update compute/zonal_instance_group_manager/main.tf

Co-authored-by: Sampath Kumar <[email protected]>

* Update compute/zonal_instance_group_manager/main.tf

Co-authored-by: Sampath Kumar <[email protected]>

* changed base instance name for instances in the mig

* added example for instance template with GPU

---------

Co-authored-by: Sampath Kumar <[email protected]>
Co-authored-by: Sampath Kumar <[email protected]>
  • Loading branch information
3 people authored Nov 29, 2023
1 parent aacb6fe commit 9fefca1
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions compute/instance_template_with_gpu/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright 2023 Google LLC
*
* 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.
*/
/**
* Made to resemble
* gcloud compute instance-templates create gpu-template \
* --machine-type n1-standard-2 \
* --boot-disk-size 250GB \
* --accelerator type=nvidia-tesla-t4,count=1 \
* --image-family debian-11 \
* --image-project debian-cloud \
* --maintenance-policy TERMINATE \
* --restart-on-failure
*/

# [START compute_template_gpu]
resource "google_compute_instance_template" "default" {
name = "gpu-template"
machine_type = "n1-standard-2"

disk {
source_image = "debian-cloud/debian-11"
disk_size_gb = 250
}

network_interface {
network = "default"
}
guest_accelerator {
type = "nvidia-tesla-t4"
count = 1
}
scheduling {
automatic_restart = true
on_host_maintenance = "TERMINATE"
}

}
# [END compute_template_gpu]

0 comments on commit 9fefca1

Please sign in to comment.