-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__main__.py
More file actions
52 lines (42 loc) · 1.39 KB
/
__main__.py
File metadata and controls
52 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import pulumi
import pulumi_openstack as openstack
IMAGE = 'Debian-10.5'
# create data volume
# this volume contains stuff like maps, maven cache and plugins but ironically, not database data
data = openstack.blockstorage.Volume('data', description='maps, plugins and stuff', size=50)
# create a database instance
# this instance hosts PostgreSQL and Redis
database = openstack.compute.Instance(
'database',
flavor_name='cc1.xsmall',
image_name=IMAGE,
key_pair='me'
)
pulumi.export('database_ip', database.access_ip_v4)
# create a craft instance
# this instance hosts game servers
craft = openstack.compute.Instance(
'craft',
flavor_name='cc1.large',
image_name=IMAGE,
block_devices=[
# boot image
openstack.compute.InstanceBlockDeviceArgs(
uuid=openstack.images.get_image(name=IMAGE).id,
source_type='image',
destination_type='local',
boot_index=0,
delete_on_termination=True
),
# data
openstack.compute.InstanceBlockDeviceArgs(
uuid=data.id,
source_type='volume',
destination_type='volume',
boot_index=1,
delete_on_termination=True
)
],
key_pair='me'
)
pulumi.export('craft_ip', craft.access_ip_v4)