I would like to create GCP instances using NVidia's VMIs.
https://catalog.ngc.nvidia.com/orgs/nvidia/collections/nvidia_vmi
Is this possible? I've search the Terraform docs and can't find anything.
I couldn't find official docs on this, it tries to direct you to the deployment manager.
However, I was able to get it work.
First run a manual deploy of the marketplace image following the steps from the marketplace. Then go into the deployment, and look at the info in Deployments once it's deployed, click on the lowest level element in the hierarchy (the machine itself). On the right you should see an info pane with something like this detailing properties (this example is for an NVIDIA VMI):
Resource properties
type
compute.v1.instance
canIpForward
false
...
sourceImage: https://www.googleapis.com/compute/v1/projects/nvidia-ngc-public/global/images/nvidia-gpu-cloud-vmi-base-x86-64-2024-05-1
...
Grab the source image url here.
Now I built up my terraform based on the "Equivalent Code" section, by clicking "Create an Instance" in the compute VM instances console.
This gives me something like this:
resource "google_compute_instance" "instance-20240711-201637" {
boot_disk {
auto_delete = true
device_name = "instance-20240711-201637"
initialize_params {
image = "projects/debian-cloud/global/images/debian-12-bookworm-v20240709"
size = 100
type = "pd-balanced"
}
The field we are going to want to change is "image", configure the rest as you see fit.
Replace the image field with everything from projects onwards in the url previously copied.
Run your terraform apply as normal.
Note: you will need to tweak the VM disk sizes etc. to suit the image. There are some terraform configurations that accept source-image as a parameter when deploying with GCP. I'm assuming if you're using that you can use the full url not just projects/.