skip to Main Content

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


  1. Chosen as BEST ANSWER

    In this particular case, the name was "deeplearning-platform-release/pytorch-latest-gpu",

    boot_disk {
        initialize_params {
          image = "deeplearning-platform-release/pytorch-latest-gpu"
          ...
        }
      }
    

    Now I m able to create the instance.


  2. 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

    Login or Signup to reply.
  3. To other newbies like me:

    Apparently GCP Marketplace is using Deployment Manager which is google’s own declarative tool to manage infrastructure. (I think modules are the closest abstraction in terraform 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 the template will show you a lot of useful details.

    Most importantly you can deduce what image was used.

    E.g.:
    In my case it showed:

    sourceImage https://www.googleapis.com/compute/v1/projects/openvpn-access-server-200800/global/images/aspub275
    

    From this I could define (based on an answer on issue #7319)

    data "google_compute_image" "openvpn_server" {
      name    = "aspub275"
      project = "openvpn-access-server-200800"
    }
    

    Which I could in turn use in google_compute_instance resource.

    This will force a recreation of the VM though.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search