I followed this tutorial for creating projects with deployment mangaer: https://cloud.google.com/blog/products/gcp/automating-project-creation-with-google-cloud-deployment-manager
Its working nicely, but I am having trouble figuring out how to create a compute instance inside the newly created project.
Everything I try gives me an error: Machine type specified 'f1-micro' is in a different project '58535xxxxxx' than the instance '919628xxxxxx'.","reason":"invalid"
The instance is trying to be created on the 'ProjectCreation' project (from the tutorial) instead of the newly created project.
The project gets created (the '58535..' number) and I try to reference that in the machineType url. Like :
'https://www.googleapis.com/compute/v1/projects/' + project_id +'/zones/us-central1-f/machineTypes/f1-micro'
I have tried in both the config.yaml and have tried adding an additional resource in the project.py. Both with the same results.
For the python I tried adding to the resources array in project.py
:
{
'name': 'server-paul-1',
'type': 'compute.v1.instance',
'metadata': {
'dependsOn': [project_id]
},
'properties': {
'zone': 'us-central1-f',
'machineType': 'https://www.googleapis.com/compute/v1/projects/' + project_id +'/zones/us-central1-f/machineTypes/f1-micro'
}
organization-id, billing-account-name, etc.
. This deployment file can be found @ github.com/GoogleCloudPlatform/deploymentmanager-samples/blob/… . It referencesproject.py
and others found in the same directory as theconfig.yaml
file – Paulo Steinitch