| 1 |
{ |
| 2 |
environments: import "../testenv.libsonnet", |
| 3 |
|
| 4 |
local SingleInstance(name) = { |
| 5 |
local service = self, |
| 6 |
|
| 7 |
environment: "google", |
| 8 |
|
| 9 |
zone:: error "Must override zone.", |
| 10 |
image:: error "Must override zone.", |
| 11 |
machineType:: "g1-small", |
| 12 |
|
| 13 |
externalIp:: false, |
| 14 |
infrastructure: { |
| 15 |
google_compute_instance: { |
| 16 |
name: { |
| 17 |
name: name, |
| 18 |
machine_type: service.machineType, |
| 19 |
zone: service.zone, |
| 20 |
boot_disk: { |
| 21 |
initialize_params: { |
| 22 |
image: service.image, |
| 23 |
}, |
| 24 |
}, |
| 25 |
network_interface: { |
| 26 |
network: "default", |
| 27 |
access_config: |
| 28 |
if service.externalIp then [{}] else [], |
| 29 |
}, |
| 30 |
metadata: { |
| 31 |
}, |
| 32 |
cmds: [], |
| 33 |
bootCmds: [], |
| 34 |
}, |
| 35 |
}, |
| 36 |
}, |
| 37 |
outputs: { |
| 38 |
[if service.externalIp then "address"]: |
| 39 |
"${google_compute_instance.%s.network_interface[0].access_config.0.nat_ip}" % name, |
| 40 |
}, |
| 41 |
}, |
| 42 |
|
| 43 |
instances: { |
| 44 |
environment: "google", |
| 45 |
infrastructure: {}, |
| 46 |
wheezy: SingleInstance('wheezy') { |
| 47 |
image: "debian-9-stretch-v20191121", |
| 48 |
zone: "us-central1-b", |
| 49 |
}, |
| 50 |
ubuntu: SingleInstance('ubuntu') { |
| 51 |
image: "ubuntu-1804-bionic-v20191113", |
| 52 |
zone: "us-central1-c", |
| 53 |
}, |
| 54 |
"core-os": SingleInstance('core-os') { |
| 55 |
image: "coreos-stable-2303-3-0-v20191203", |
| 56 |
zone: "us-central1-f", |
| 57 |
externalIp: true, |
| 58 |
}, |
| 59 |
}, |
| 60 |
} |