Web server using OpenStack
A minimal OpenStack Python Pulumi program
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set openstack-py-webservercd pulumi-examples/openstack-py-webserverA minimal example that provisions a Fedora instance and its security group rules on OpenStack.
Prerequisites#
Deploying the example#
-
Create a new stack:
Terminal window pulumi stack init -
Install dependencies:
Terminal window python3 -m venv venvsource venv/bin/activatepip install -r requirements.txt -
Modify
__main__.pyto include your keypair and image. -
Run
pulumi upto preview and deploy changes:Terminal window pulumi upPreviewing update (dev):Type Name Planpulumi:pulumi:Stack pulum-dev+ ├─ openstack:images:Image fedora create+ ├─ openstack:compute:Keypair default create+ ├─ openstack:networking:SecGroupRule secgroupRule1 create+ ├─ openstack:networking:SecGroupRule secgroupRule2 create+ ├─ openstack:networking:SecGroupRule secgroupRule3 create+ └─ openstack:compute:Instance test_fedora createOutputs:~ instance_ip: "192.168.0.243" => output<string>Resources:+ 6 to create1 unchangedDuration: 38s -
View the host name and IP address of the instance via
stack output:Terminal window pulumi stack outputCurrent stack outputs (1):OUTPUT VALUEinstance_ip 192.168.0.243 -
Verify that the OpenStack instance exists, by either using the Horizon dashboard or running
openstack server list:Terminal window openstack server list+--------------------------------------+-------------+--------+-------------------------------------+--------------------------+----------+| ID | Name | Status | Networks | Image | Flavor |+--------------------------------------+-------------+--------+-------------------------------------+--------------------------+----------+| 8bdf8a6d-ac53-4448-ae09-e2a08ad554a0 | test_fedora | ACTIVE | public=192.168.0.243, 2001:db8::36b | fedora | m1.small |+--------------------------------------+-------------+--------+-------------------------------------+--------------------------+----------+
Cleaning up#
Once you’re finished experimenting, destroy your stack and remove it to avoid incurring any additional cost:
pulumi destroypulumi stack rm