I use "@google-cloud/compute": "^2.1.0"
to create a VM, and I set 'ONE_TO_ONE_NAT' as shown below.
The issue is that the VM is not created with a public IP.
If I add http:true in the config, then the public IP is created but I would like to avoid the http tag in the config.
For me it looks like a bug as it should work according to the documentation.
Any idea why it is not working? (apart from a bug)
const config = {
//http: true,
machineType: machineType,
disks: [
{
boot: true,
initializeParams: {
sourceImage: SOURCE_IMAGE_PREFIX + projectId + SOURCE_IMAGE_PATH,
},
},
],
networkInterfaces: [
{
network: 'global/networks/default',
accessConfigs: {
type: 'ONE_TO_ONE_NAT',
name: 'External NAT',
},
},
],
metadata: {
items: [
{
key: 'startup-script',
value: `#! /bin/bash
sudo docker run ...
},
],
}
};
It's just a mistake, that took lot of time to find!!!
accessConfigs
is an array!! add [], like this
accessConfigs: [{
type: 'ONE_TO_ONE_NAT',
name: 'External NAT',
}],