I m trying to create terraform script to launch the fastai instance from the marketplace.
I m adding image name as,
boot_disk {
initialize_params {
image = "<image name>"
}
}
When I add
click-to-deploy-images/deeplearning
from url
https://console.cloud.google.com/marketplace/details/click-to-deploy-images/deeplearning
is giving error,
Error: Error resolving image name 'click-to-deploy-images/deeplearning': Could not find image or family click-to-deploy-images/deeplearning
on fastai.tf line 13, in resource "google_compute_instance" "default":
13: resource "google_compute_instance" "default" {
If I use
debian-cloud/debian-9
from url
https://console.cloud.google.com/marketplace/details/debian-cloud/debian-stretch?project=<>
is working.
Can we deploy fastai image through terraform?
3
Answers
In this particular case, the name was "deeplearning-platform-release/pytorch-latest-gpu",
Now I m able to create the instance.
I made a deployment from the deep learning marketplace VM instance you share and review the source image[1], you should be able to use that url I provided to deploy with Terraform. I also notice a warning image stating that image is deprecated and there is this new version[2].
Hope this helps!
[1]sourceImage: https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/tf2-2-1-cu101-20200109
[2]https://www.googleapis.com/compute/v1/projects/click-to-deploy-images/global/images/tf2-2-1-cu101-20200124
To other newbies like me:
Apparently GCP Marketplace is using Deployment Manager which is google’s own declarative tool to manage infrastructure. (I think
module
s are the closest abstraction interraform
to it.)Hence, there is no simple/single answer to the question in the title.
In my opinion – if you start from scratch and/or can afford the effort the time – the best is to use
terraform
modules instead of GCP marketplace solutions – if such exists.However, changes are good that you are importing an existing infra and you cannot just replace it immediately (or there is no such module).
In this case, I think the best that you can do is go to Deployment Manager in google console and open the particular deployment you need to import.
At this point you can see what resources make up the deployment. Probably there will be
vm template
(s),vm
(s),firewall rule
(s), etc…Clicking on
vm instance
and thetemplate
will show you a lot of useful details.Most importantly you can deduce what image was used.
E.g.:
In my case it showed:
From this I could define (based on an answer on issue #7319)
Which I could in turn use in
google_compute_instance
resource.This will force a recreation of the VM though.