Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Deploy this example with Pulumi Deploy this example with Pulumi

Web server using OpenStack

A minimal example that provisions a Fedora instance and its security group rules on OpenStack.

Prerequisites

  1. Install Pulumi
  2. Configure Pulumi for OpenStack
  3. Install Python

Deploying the example

  1. Create a new stack:

    pulumi stack init
  2. Install dependencies:

    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
  3. Modify __main__.py to include your keypair and image.

  4. Run pulumi up to preview and deploy changes:

    pulumi up
    Previewing update (dev):
        Type                                  Name           Plan
        pulumi: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    create
    
    Outputs:
    ~ instance_ip: "192.168.0.243" => output<string>
    
    Resources:
        + 6 to create
        1 unchanged
    
    Duration: 38s
    
  5. View the host name and IP address of the instance via stack output:

    pulumi stack output
    Current stack outputs (1):
        OUTPUT       VALUE
        instance_ip  192.168.0.243
    
  6. Verify that the OpenStack instance exists, by either using the Horizon dashboard or running openstack server list:

    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 destroy
pulumi stack rm