2024-04-19 01:04:52 +02:00
|
|
|
"""A Linode Python Pulumi program"""
|
|
|
|
|
|
|
|
import pulumi
|
|
|
|
import pulumi_linode
|
|
|
|
import yaml
|
|
|
|
from dotmap import DotMap
|
|
|
|
|
2024-04-19 01:19:27 +02:00
|
|
|
config = DotMap(yaml.safe_load(open("input.yaml").read()))
|
2024-04-19 01:04:52 +02:00
|
|
|
|
|
|
|
# Create a Linode resource (Linode Instance)
|
2024-04-19 01:19:27 +02:00
|
|
|
instance = pulumi_linode.Instance(config.vm.name,
|
2024-04-19 01:04:52 +02:00
|
|
|
type=config.linode.type,
|
|
|
|
region=config.linode.region,
|
|
|
|
image=config.linode.image,
|
|
|
|
label=config.vm.name,
|
|
|
|
root_pass=config.vm.root_password,
|
2024-04-19 01:09:07 +02:00
|
|
|
authorized_keys=config.vm.sshkeys,
|
2024-04-19 01:04:52 +02:00
|
|
|
opts=pulumi.ResourceOptions(
|
|
|
|
custom_timeouts=pulumi.CustomTimeouts(create="2m")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
# Export the Instance label of the instance
|
|
|
|
pulumi.export('ip_address', instance.ip_address)
|