When I initialize a VM with one or more disks, following official documentation example it creates for me specified disks as configured.
As soon as disks
config is not empty array, it always fails with one of following errors:
Invalid value for field 'resource.disks[0]':
'{ "initializeParams": {
"sourceImage": "https://www.googleapis.com/compute/v1/projects/ubuntu-os...'.
Boot disk must be the first disk attached to the instance.``'" } }'
Invalid value for field 'resource.disks[1]':
'{ "boot": true,
"initializeParams": {
"sourceImage": "https://www.googleapis.com/compute/v1/pro...'.
Boot disk must be the first disk attached to the instance.'" } }'
That happens because of this line.
The code always adds an object with the config to the last position of the disks
config array. For the VM is important to have a proper config.
If I add a bootable disk, then it fails with Error 1. If I add a not bootable disk - it fails with Error 2.
- You have a project on google cloud.
- You have a service key with enough permissions to do admin actions with VMs
Make a clone of this repo and do
npm install
Run reproduce
command with the following env variables set:
GOOGLE_APPLICATION_CREDENTIALS
- path to a file which authorize gcloud api requestsPROJECT_ID
- an id of your project in google cloud
GOOGLE_APPLICATION_CREDENTIALS=/path/to/file PROJECT_ID=project-id npm run reproduce