| { | |
| "Name": "read-cos-env", | |
| "Sources": { | |
| "cloud-config": "read_cos_env.yaml" | |
| }, | |
| "Vars": { | |
| "disk_size_gb": { | |
| "Value": "", | |
| "Description": "The disk size to use." | |
| }, | |
| "disk_type": { | |
| "Value": "pd-standard", | |
| "Description": "The disk type to use." | |
| }, | |
| "host_maintenance": { | |
| "Value": "MIGRATE", | |
| "Description": "VM behavior when there is maintenance." | |
| }, | |
| "machine_type": { | |
| "Value": "", | |
| "Required": true, | |
| "Description": "Machine type to boot COS image on." | |
| }, | |
| "network": { | |
| "Value": "", | |
| "Description": "Network to use." | |
| }, | |
| "service_account": { | |
| "Value": "default", | |
| "Description": "Service account to use." | |
| }, | |
| "source_image": { | |
| "Value": "", | |
| "Required": true, | |
| "Description": "COS image to read environment from" | |
| }, | |
| "subnet": { | |
| "Value": "", | |
| "Description": "Subnetwork to use." | |
| } | |
| }, | |
| "Steps": { | |
| "setup": { | |
| "CreateDisks": [ | |
| { | |
| "name": "boot-disk", | |
| "sourceImage": "${source_image}" | |
| } | |
| ] | |
| }, | |
| "run": { | |
| "CreateInstances": [ | |
| { | |
| "Scopes": [ | |
| "https://www.googleapis.com/auth/devstorage.read_write", | |
| "https://www.googleapis.com/auth/cloud-platform" | |
| ], | |
| "disks": [ | |
| { | |
| "source": "boot-disk" | |
| } | |
| ], | |
| "labels": { | |
| "cos-customizer-cleanup": "" | |
| }, | |
| "machineType": "${machine_type}", | |
| "name": "read-cos-env-vm", | |
| "networkInterfaces": [ | |
| { | |
| "network": "${network}", | |
| "subnetwork": "${subnet}" | |
| } | |
| ], | |
| "scheduling": { | |
| "onHostMaintenance": "${host_maintenance}" | |
| }, | |
| "serviceAccounts": [ | |
| { | |
| "email": "${service_account}", | |
| "scopes": [ | |
| "https://www.googleapis.com/auth/cloud-platform", | |
| "https://www.googleapis.com/auth/devstorage.read_write" | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "user-data": "${SOURCE:cloud-config}" | |
| } | |
| } | |
| ] | |
| }, | |
| "wait-vm-finished": { | |
| "WaitForInstancesSignal": [ | |
| { | |
| "Name": "read-cos-env-vm", | |
| "Interval": "5s", | |
| "SerialOutput": { | |
| "Port": 3, | |
| "SuccessMatch": "EnvSucceeded:", | |
| "failureMatch": [ | |
| "EnvFailed:" | |
| ], | |
| "StatusMatch": "EnvStatus:" | |
| } | |
| } | |
| ] | |
| }, | |
| "wait-vm-shutdown": { | |
| "WaitForInstancesSignal": [ | |
| { | |
| "Name": "read-cos-env-vm", | |
| "Interval": "2s", | |
| "Stopped": true | |
| } | |
| ] | |
| } | |
| }, | |
| "Dependencies": { | |
| "run": [ | |
| "setup" | |
| ], | |
| "wait-vm-finished": [ | |
| "run" | |
| ], | |
| "wait-vm-shutdown": [ | |
| "wait-vm-finished" | |
| ] | |
| }, | |
| "ForceCleanupOnError": true | |
| } |