Open SamyPesse opened 3 years ago
Thank you for your question! It looks like the example you linked uses the beta API of the compute
service but, indeed, I don't see any container-related properties in the Discovery Document (the API spec) that Google provides, see here.
I will ask Google folks to check why.
@SamyPesse One option to figure out what is going on: if you have a gcloud CLI command that works for you, you could run it with --log-http
parameter and see the actual HTTP requests that it issues. If you paste those in this issue, it would be super helpful.
Hello! I work with GCP and I can share some insights here.
Unfortunately, creating instances and templates that run containers is currently limited to Cloud Console and gcloud
tool only. If you go into Cloud Console, click through the Instance creation page and click "Equivalent REST", you'll see the API request with:
"metadata": {
"items": [
{
"key": "gce-container-declaration",
"value": "spec:\n containers:\n - name: instance-1\n image: ngingx\n stdin: false\n tty: false\n restartPolicy: Always\n# This container declaration format is not public API and may change without notice. Please\n# use gcloud command-line tool or Google Cloud Console to run Containers on Google Compute Engine."
}
]
},
Most important is the comment:
This container declaration format is not public API and may change without notice. Please use gcloud command-line tool or Google Cloud Console to run Containers on Google Compute Engine.
As you can see, the way we create instances hosting containers is not fully finalized yet and the way it's done is subject to change. Obviously, with the REST preview, you can reverse engineer how it's done right now, but it's not really recommended.
Let me know if you have any further questions.
How about we create an experimental Pulumi Package to handle this? We can release this under Pulumiverse, and I would love to contribute to it.
It would be like https://registry.terraform.io/modules/terraform-google-modules/container-vm/google/latest on Terraform
GCP supports creating instance template to deploy docker container: https://cloud.google.com/compute/docs/containers/deploying-containers#managedinstancegroupcontainer / https://cloud.google.com/sdk/gcloud/reference/beta/compute/instance-templates/create-with-container
But it doesn't seem possible to do it with Pulumi at the moment (with native or the classic). Am I missing something?