diff --git a/linode/.gitignore b/linode/.gitignore new file mode 100644 index 0000000..a3807e5 --- /dev/null +++ b/linode/.gitignore @@ -0,0 +1,2 @@ +*.pyc +venv/ diff --git a/linode/Pulumi.yaml b/linode/Pulumi.yaml new file mode 100644 index 0000000..427e78b --- /dev/null +++ b/linode/Pulumi.yaml @@ -0,0 +1,5 @@ +name: ${PROJECT} +description: ${DESCRIPTION} +runtime: python +template: + description: A Pulumi deployment with Linode cloud and Python diff --git a/linode/__main__.py b/linode/__main__.py new file mode 100644 index 0000000..bcc9613 --- /dev/null +++ b/linode/__main__.py @@ -0,0 +1,25 @@ +"""A Linode Python Pulumi program""" + +import pulumi +import pulumi_linode +import yaml +from dotmap import DotMap + +conf = DotMap(yaml.safe_load(open("input.yaml").read())) +config = pulumi.Config() + +# Create a Linode resource (Linode Instance) +instance = pulumi_linode.Instance('my-instance', + type=config.linode.type, + region=config.linode.region, + image=config.linode.image, + label=config.vm.name, + root_pass=config.vm.root_password, + authorized_keys=config.vm.sshkeys + opts=pulumi.ResourceOptions( + custom_timeouts=pulumi.CustomTimeouts(create="2m") + ) +) + +# Export the Instance label of the instance +pulumi.export('ip_address', instance.ip_address) diff --git a/linode/input.yaml b/linode/input.yaml new file mode 100644 index 0000000..f41d70d --- /dev/null +++ b/linode/input.yaml @@ -0,0 +1,14 @@ +--- +linode: + type: g6-nanode-1 + region: eu-central + image: linode/debian12 + +# Basic VM configuration +vm: + name: linode-test + root_password: cicciopasticcio + sshkeys: + - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFioHkaV1NhX6NCqsJakJw8EVBOcDHm1MEbpY499CPtG syntaxerrormmm@fisso" + - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILu91hBh8pNRt4eE1pug0Y4jCHZDCcMJ+vj3CiF5EQHV syntaxerrormmm@syntaxxps" + - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILH5q/ObtC4VhNT88gebezP/svpvCoQLoZCh4DvUn4xq syntaxerrormmm@taz" diff --git a/linode/requirements.txt b/linode/requirements.txt new file mode 100644 index 0000000..f05c2d8 --- /dev/null +++ b/linode/requirements.txt @@ -0,0 +1,4 @@ +pulumi>=3.0.0,<4.0.0 +pulumi-linode>=4.0.0,<5.0.0 +pyyaml>=6.0 +dotmap>=1.3.30