starkandwayne/terraform-provider-openstack

Name: terraform-provider-openstack

Owner: Stark & Wayne

Description: OpenStack Provider for Terraform using gophercloud

Created: 2015-01-29 23:57:14.0

Updated: 2015-01-31 18:24:57.0

Pushed: 2015-01-31 18:24:56.0

Homepage: null

Size: 165

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

terraform-provider-openstack

This is an experimental OpenStack provider for Terraform. It is based off of the excellent work already done by haklop which can be found here. The main difference is that it works with the latest version of gophercloud and does not need to be compiled along with the entire Terraform code.

However, it only supports the openstack_compute resource at this time. Even more, not all functionality (such as resizing) has been implemented or tested.

Only launching and destroying an instance in a nova-network based environment has been tested so far.

Warning

I have almost no knowledge of Go. This work consists of me copying copying other examples and being amazed that any of this actually works. If things look sloppy and outright wrong, they are.

Also, please be aware that this is just me fooling. If you'd like to take over work in a more serious manner, by all means, go for it.

Installation

Download the provider:

 get github.com/jtopjian/terraform-provider-openstack

Download and install the dependencies:

 $GOPATH/src/github.com/jtopjian/terraform-provider-openstack
dep restore

Compile it:

 build -o terraform-provider-openstack

Copy it to the directory you keep Terraform:

do cp terraform-provider-openstack /usr/local/bin/terraform
Usage
Provider Authentication

You can authenticate with the OpenStack cloud by either explicitly setting parameters or using an openrc-style file.

Explicit Parameters
ider "openstack" {
entity_endpoint = "http://example.com:5000/v2.0"
ername = "jdoe"
nant_name = "jdoe"
ssword = "password"

openrc-style

First, source your openrc file:

urce openrc

Next, configure the provider in the *.tf file:

ier "openstack" { }

For more information on OpenStack openrc files, see [http://docs.openstack.org/user-guide/content/cli_openrc.html].

Terraform Configuration

The following examples have been tested:

ider "openstack" {}

urce "openstack_compute" "test" {
me = "jttest"
age_id = "ecdd59d0-eff5-4d1b-be5e-dde94ffcfdb2"
or image_name = "Ubuntu 14.04"
avor_ref = "1"
or flavor_name = "m1.large"
y_name = "my_key"
tworks = [ "94e12a2a-d692-4e6f-8e34-560e8a97ead5" ]
curity_groups = [ "default", "my_custom_group" ]
er_data = "#!/bin/bash\nping -c 10 yahoo.com"
nfig_drive = true
tadata {
foo = "bar"
baz = "foo"


Launch
rraform plan
rraform build
rraform destroy
Notes

image_id, flavor_ref, and networks must be the UUIDs and not the canonical names. Also that the networks must be in array/list format.

networks is optional if your OpenStack cloud only has one network.

admin_pass is enabled, but I haven't verified it yet.

network is available for specific networking configuration. One or more of the following can be specified:

ork {
id: "94e12a2a-d692-4e6f-8e34-560e8a97ead5"
Not fully tested yet
rt: "(port uuid)"
Not fully tested yet
xed_ip: "10.1.1.150"

Credits

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.