New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for OpenStack (including Rackspace Cloud) #51

Closed
jumoel opened this Issue Jul 28, 2014 · 48 comments

Comments

Projects
None yet
@jumoel

jumoel commented Jul 28, 2014

Are there any plans for a Rackspace provider in terraform?

@pearkes

This comment has been minimized.

Member

pearkes commented Jul 28, 2014

We don't currently have immediate plans to add one, no. We'd love to see one from the community! I'm happy to help if necessary.

@alex

This comment has been minimized.

Contributor

alex commented Jul 28, 2014

It should probably start as adding support for OpenStack clouds in general, and then the Rackspace support is just setting up a default identity endpoint.

@pearkes

This comment has been minimized.

Member

pearkes commented Jul 28, 2014

Agree with @alex, similar to how packer handles it. Going to rename this issue accordingly. Thanks!

@pearkes pearkes changed the title from Support for Rackspace Cloud to Support for OpenStack (including Rackspace Cloud) Jul 28, 2014

@pearkes pearkes added the enhancement label Jul 28, 2014

@haklop

This comment has been minimized.

Contributor

haklop commented Aug 14, 2014

I've started implementing an OpenStack provider (https://github.com/haklop/terraform/tree/openstack-provider). We can currently interact with Compute and Neutron for creating instances, private networks, security rules and routers. I am now working on the LBaaS support.

There are still many works to do but we can already do some nice infrastructures.

@alex

This comment has been minimized.

Contributor

alex commented Aug 14, 2014

@haklop @jrperritt and I also started working on an OpenStack provider, it sounds like we should coordinate

@tdooner

This comment has been minimized.

tdooner commented Aug 15, 2014

@haklop Just want to briefly chime in here that I was able to pull your branch, build it, and successfully spawn a server with it. I'm a new Rackspace customer so I'm cheering for the ability to start my build-out with terraform. I did need to make a couple changes for it to work:

  1. Rackspace names its API endpoints unconventionally, so I had to change "nova" to "cloudServersOpenStack" in builtin/providers/openstack/resource_provider.go. Perhaps that should be configurable, or there should be some kind of inheritance for Rackspace that sets the value correctly. I expect the same problem will happen with the network API.
  2. This commit in gophercloud breaks this line in your gophercloud-extensions. I fixed it temporarily by basically copying the diff in place of ErrEndpoint in your network.go.

Thanks for your awesome work on this terraform provider. I'm really excited for when this hits master!

@nibalizer nibalizer referenced this issue Sep 30, 2014

Merged

Docs Fixup #341

@nibalizer

This comment has been minimized.

Contributor

nibalizer commented Oct 3, 2014

So I was able to, folowing notes from @tdooner, use @haklops patch to hit rackspace with terraform. I was not, however, able to use HP cloud. After looking at it with some people I think the problem might be around here https://github.com/rackspace/gophercloud/blob/master/authenticate.go#L90 in gopherclient. Basically when hitting HP cloud you need to specify a region, rax will allow you to ask for and recieve a default region.

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 14, 2014

I'm having trouble getting this to build. Any help would be appreciated. I'm a novice Go programmer.

I'm on a mac running 10.9.5 and I can successfully build bin/terraform from the Hashicorp repository by following the instructions in the README.md.

If I clone haklop's terraform repository and try to repeat the build I get the following error at the make updatedeps step:

allez:terraform georgewh$ make updatedeps
cd config/ && \
        go tool yacc -p "expr" expr.y
go get -u -v ./...
github.com/haklop/terraform (download)
github.com/hashicorp/hcl (download)
github.com/hashicorp/terraform (download)
github.com/mitchellh/copystructure (download)
github.com/mitchellh/reflectwalk (download)
github.com/mitchellh/mapstructure (download)
github.com/mitchellh/cli (download)
github.com/mitchellh/colorstring (download)
github.com/mitchellh/go-homedir (download)
github.com/hashicorp/yamux (download)
github.com/mitchellh/osext (download)
github.com/mitchellh/panicwrap (download)
github.com/mitchellh/prefixedio (download)
github.com/mitchellh/goamz (download)
github.com/vaughan0/go-ini (download)
github.com/pearkes/cloudflare (download)
github.com/armon/consul-api (download)
github.com/pearkes/digitalocean (download)
github.com/pearkes/dnsimple (download)
package github.com/haklop/terraform
    imports github.com/hashicorp/hcl
    imports github.com/hashicorp/hcl/hcl
    imports github.com/hashicorp/terraform/helper/multierror
    imports github.com/hashicorp/hcl/json
    imports github.com/hashicorp/terraform/command
...
  imports github.com/hashicorp/terraform/builtin/providers/dnsimple
    imports github.com/pearkes/dnsimple
    imports github.com/haklop/terraform/builtin/bins/provider-google: cannot find package "github.com/haklop/terraform/builtin/bins/provider-google" in any of:
    /usr/local/go/src/pkg/github.com/haklop/terraform/builtin/bins/provider-google (from $GOROOT)
    /Users/georgewh/go/src/github.com/haklop/terraform/builtin/bins/provider-google (from $GOPATH)
code.google.com/p/go-uuid (download)
github.com/cyberdelia/heroku-go (download)
package github.com/haklop/terraform
    imports github.com/hashicorp/hcl
    imports github.com/hashicorp/hcl/hcl
    imports github.com/hashicorp/terraform/helper/multierror
  ...
  imports code.google.com/p/go-uuid/uuid
    imports github.com/cyberdelia/heroku-go/v3
    imports github.com/hashicorp/terraform/builtin/providers/heroku
    imports github.com/haklop/terraform/builtin/bins/provider-mailgun: cannot find package "github.com/haklop/terraform/builtin/bins/provider-mailgun" in any of:
    /usr/local/go/src/pkg/github.com/haklop/terraform/builtin/bins/provider-mailgun (from $GOROOT)
    /Users/georgewh/go/src/github.com/haklop/terraform/builtin/bins/provider-mailgun (from $GOPATH)
package github.com/haklop/terraform
    imports github.com/hashicorp/hcl
    imports github.com/hashicorp/hcl/hcl
...
    imports github.com/haklop/terraform/helper/multierror
    imports github.com/haklop/terraform/helper/resource
    imports github.com/haklop/terraform/helper/schema: cannot find package "github.com/haklop/terraform/helper/schema" in any of:
    /usr/local/go/src/pkg/github.com/haklop/terraform/helper/schema (from $GOROOT)
    /Users/georgewh/go/src/github.com/haklop/terraform/helper/schema (from $GOPATH)
make: *** [updatedeps] Error 1

I've snipped a large amount of text out of the middle. It seems to have trouble finding these packages:

cannot find package "github.com/haklop/terraform/builtin/bins/provider-google" in any of:
cannot find package "github.com/haklop/terraform/builtin/bins/provider-mailgun" in any of:
cannot find package "github.com/hashicorp/terraform/builtin/providers/openstack" in any of:
cannot find package "github.com/haklop/terraform/builtin/providers/google" in any of:
cannot find package "github.com/haklop/terraform/builtin/providers/mailgun" in any of:
cannot find package "github.com/haklop/terraform/config/module" in any of:
cannot find package "github.com/haklop/terraform/helper/hashcode" in any of:
cannot find package "github.com/haklop/terraform/helper/schema" in any of:

My clone of the Hashicorp repository does exist in github.com/hashicorp/terraform.

Anyone have any suggestions or hints?

Thanks!

g.

@nibalizer

This comment has been minimized.

Contributor

nibalizer commented Oct 14, 2014

Yea you do have to move the haklop/terraform into hashicorp/terraform. Not really sure what the 'rigth' way to do that is. i need to lrn2go as well. Or go needs to be more functional with the github workflow.

@haklop

This comment has been minimized.

Contributor

haklop commented Oct 15, 2014

My fork has to be in github.com/hashicorp/terraform. On your local terraform repository:

  • git remote add openstack https://github.com/haklop/terraform.git
  • git fetch openstack
  • git checkout -b openstack-provider openstack/openstack-provider

Also you can't use make updatedeps on my fork and I have no idea why. You have to replace this step by go get -u -v ./.... And be sure after that to checkout on the openstack-provider branch and finally make dev

@devcamcar

This comment has been minimized.

devcamcar commented Oct 15, 2014

@haklop @nibalizer I helped add support for OpenStack to Packer and would be happy to help with Terraform as well.

@Veraticus

This comment has been minimized.

Veraticus commented Oct 16, 2014

@devcamcar I've been waiting for this feature with bated breath for so long... I'm no go guru so I can't really assist myself, but consider your amazing offer 👍 'd a million times!

@nibalizer

This comment has been minimized.

Contributor

nibalizer commented Oct 18, 2014

It sounds like there is a lot of interest and people willing to work on this. What do people think about having an irc meetup or google hangout to have a working session to get this complete?

@Veraticus

This comment has been minimized.

Veraticus commented Oct 21, 2014

I think that'd be awesome! I'd be happy to help organize something to make this happen.

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 21, 2014

Great, this worked (in $GOPATH/src/github.com/hashicorp):

  378  rm -rf terraform/
  379  pwd
  380  git clone https://github.com/hashicorp/terraform.git terraform
  381  cd terraform/
  382  git remote add openstack https://github.com/haklop/terraform.git
  383  git fetch openstack
  384  git checkout -b openstack-provider openstack/openstack-provider
  385  make dev

and I now have an terraform-provider-openstack. Now to get playing!

Thanks,

g.

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 22, 2014

Another small success, and one more tidbit of information. On our Nebula cluster, I can assign floating ip addresses to machines using the floating ip pool name "nebula". I don't know if this is something unique to our setup or a general characteristic of the Nebula variant of OpenStack.

@nibalizer

This comment has been minimized.

Contributor

nibalizer commented Oct 22, 2014

What if we get together on freenode in #terraform on Tuesday Oct 28th at 1pm Pacific?

@devcamcar

This comment has been minimized.

devcamcar commented Oct 22, 2014

@nibalizer That works for me!

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 23, 2014

I've been playing around with the support for security groups, and I think that I'm stuck. I believe (still waiting on confirmation) that Nebula stuck with nove networking when the rest of the openstack community moved to neutron. If that's true, I'll probably have to figure out how to wire it in.

Along the way I discovered that the config file parser is not particularly helpful, having

protocol = tcp

as part of a rule (eg. on line 7) generates the less than helpful error message:

Error loading config: Error parsing /Users/georgewh/tmp/nebula.tf: Line 10, column -1: syntax error

until you replace it with

protocol = "tcp"

(strings must be quoted...).

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 23, 2014

@haklop (or anyone else who can fill me in...)

Can you say a bit about how the tests for the openstack stuff work? While I was trying to debug my missing quotes problem described above, I played around with the tests in:

resource_openstack_security_group_test.go

They seem to be compiled and linked and run (adding calls to panic in various places causes the tests to fail, but changing the expected values in the test assertions doesn't seem to have any effect. Neither does removing the double quotes around the protocol value (as described above).

Thanks!

@devcamcar

This comment has been minimized.

devcamcar commented Oct 24, 2014

@hartzell Yes, Nebula uses nova-network and not neutron for a variety of reasons. We were able to get things with Packer working well against Nebula and I expect we can do the same with Terraform without too much trouble.

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 27, 2014

@devcamcar Can you point me at any documentation for the nova-network HTTP API. Google keeps leading me to the neutron version. Thanks!

@anguslees

This comment has been minimized.

anguslees commented Oct 28, 2014

On Mon, 27 Oct 2014 08:50:34 AM George Hartzell wrote:

@devcamcar Can you point me at any documentation for the nova-network
HTTP API. Google keeps leading me to the neutron version. Thanks!

http://docs.openstack.org/api/openstack-compute/2/content/ext-os-networks.html

  • Gus
@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 29, 2014

Thanks for the pointer, but that documentation does not quite match what works against our Nebula system (I'm not sure which is out of date/incorrect...).

For example, this section of that doc on os-security-groups suggests that something like this is how one adds a security group:

echo '{"addSecurityGroup": { "name": "moose"}}' | http POST http://proxy.nebula.example.com:8774/v2/6ba254b787054e23a3abe5030f416b4f/os-security-groups X-Auth-Token:f8350eaae3574164961498adea9fe9c9
HTTP/1.1 422 Unprocessable Entity
Content-Length: 90
Content-Type: application/json; charset=UTF-8
Date: Wed, 29 Oct 2014 15:05:52 GMT
X-Compute-Request-Id: req-12e5007a-f54c-4e70-a091-29f09803ea40
X-Frame-Options: deny

{
    "computeFault": {
        "code": 422,
        "message": "Unable to process the contained instructions"
    }
}

When in fact this is what appears to work:

allons:terraform georgewh$ echo '{"security_group": {"description": "whee", "name": "fee fi fo fum","tenant_id": "6ba254b787054e23a3abe5030f416b4f"}}' | http POST http://proxy.nebula.example.com:8774/v2/6ba254b787054e23a3abe5030f416b4f/os-security-groups X-Auth-Token:f8350eaae3574164961498adea9fe9c9
HTTP/1.1 200 OK
Content-Length: 140
Content-Type: application/json
Date: Wed, 29 Oct 2014 15:09:55 GMT
X-Compute-Request-Id: req-461011bc-bd21-47d6-89be-def16ec5afd2
X-Frame-Options: deny

{
    "security_group": {
        "description": "whee",
        "id": 62,
        "name": "fee fi fo fum",
        "rules": [],
        "tenant_id": "6ba254b787054e23a3abe5030f416b4f"
    }
}

I've taken to reversing the code in the nova client to figure out what needs to happen. Frustrating, but workable.

I asked @haklop for feedback on how he'd like to see support for both nova and neutron based os-security-groups co-exist, then I can take a stab at it.

@zzamboni

This comment has been minimized.

zzamboni commented Oct 29, 2014

For reference, I got the Openstack provider to compile by following @hartzell's instructions above, but I had to manually install some dependencies (rackspace/gophercloud and some other things). Here is a script that @byllc and I put together that does the installation. This has been tested on a clean Ubuntu 14.04 install: https://gist.github.com/zzamboni/38f04d427290bc4f2787

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 30, 2014

@zzamboni, if you run this:

go get -u -v ./...

after you pull in @haklops' bits, it should take care of the dependencies for you, without having to explicitly specify them in your script.

Does it work for you?

@zzamboni

This comment has been minimized.

zzamboni commented Oct 30, 2014

@hartzell: I tried this, but apparently at some point it reverts the terraform repo to the master branch (from openstack-provider), so it fails when trying to process github.com/hashicorp/terraform/builtin/providers/openstack. See the output here: https://gist.github.com/zzamboni/9ed57d521e80b6934186

Any clues about this?

@kanerogers

This comment has been minimized.

kanerogers commented Oct 31, 2014

Just chiming in with a giant 👍

@hartzell

This comment has been minimized.

Contributor

hartzell commented Oct 31, 2014

@zzamboni, sorry, nothing helpful to add. I'm not sure what I did to pull in those deps without doing them one at a time, but I seem to have.

Anyone with more build-fu have any thoughts?

@hartzell

This comment has been minimized.

Contributor

hartzell commented Nov 3, 2014

FWIW, I updated my copy of github.com/rackspace/gophercloud this morning and @haklop's openstack support no longer builds.

I have a copy of rackspace/gophercloud tree that works, it's last commit is:

commit e13cda260ce48d63ce816f4fa72b6c6cd096596d

There seems to have been a great deal that has be removed and/or rearranged since then.

g.

@hartzell

This comment has been minimized.

Contributor

hartzell commented Nov 3, 2014

Another FWIW, here is some background reading on @haklop's solution to my problem with go and package import paths and github forks.

@zzamboni

This comment has been minimized.

zzamboni commented Nov 3, 2014

George, I had to checkout tag release/v0.1.1 from gophercloud for haklop's branch to build. On Mon, Nov 3, 2014 at 3:49 PM, George Hartzell notifications@github.com wrote: FWIW, I updated my copy of github.com/rackspace/gophercloud this morning and @haklop's openstack support no longer builds.

I have a copy of rackspace/gophercloud tree that works, it's last commit is:

commit e13cda260ce48d63ce816f4fa72b6c6cd096596d

There seems to have been a great deal that has be removed and/or rearranged since then.

g.

—Reply to this email directly or view it on GitHub.

@hartzell

This comment has been minimized.

Contributor

hartzell commented Nov 4, 2014

I believe that I've identified a problem with floating-ip assignment to new servers.

What works: create a terraform input file with one server, apply it; add the definition for a second server, apply it. Each server seems to end up with a floating ip number and happy.

What does not work: create a terraform input file with two servers. Sometimes/usually Terraform believes that both servers have been assigned the same floating ip address. The nova command client only sees the address associated with one of the servers.

A possible diagnosis: I believe that there is a race around lines 130-154 in resource_openstack_compute.go. Terraform gets the list of a available floating ips, the configuration process for both servers grabs e.g. the first one, and hilarity ensues.

As usual, I can't find accurate documentation for how that API is supposed to work, I end up here but that doesn't match what the nova client does and doesn't say anything useful about error responses.

It seems that the right/brute-force solution is to walk the list of available IP's until the server gets one or there are none left or allocatable. I don't see any hint of anything cleaner.

@hartzell

This comment has been minimized.

Contributor

hartzell commented Nov 4, 2014

I just submitted a pull request to get user_data working in the config file. I've successfully used it to configure coreos systems on our nebula openstack cluster.

@kanerogers

This comment has been minimized.

kanerogers commented Dec 3, 2014

Hey @hartzell, looks like you had some good success with rackspace/gophercloud guys! Any update on how this is going - I think there's a few of us waiting with baited breath over here! 😸

@hartzell

This comment has been minimized.

Contributor

hartzell commented Dec 12, 2014

Aplogies for the lack of communication, higher priority work has been getting in the way.

@jrperritt been helpful on the gophercloud front. I need to pick the thread up with him and @haklop and see what's happening.

@kanerogers, what in particular are you waiting for (specific features, something that works, etc...) and who/what/where is your target OpenStack implementation?

@nibalizer

This comment has been minimized.

Contributor

nibalizer commented Dec 12, 2014

I would hope we can hit rackspace, hpcloud, and a devstack. Those are all pretty easy to test.

@kanerogers

This comment has been minimized.

kanerogers commented Dec 13, 2014

Rackspace is my homeboy. HEAT has a lot of promise, but it's just not there yet. 

K


Kane RogersProduct Manager

CleanStream

t: +61 401 633 346

e: kane@cleanstream.com.au

On Sat, Dec 13, 2014 at 10:30 AM, Spencer Krum notifications@github.com
wrote:

I would hope we can hit rackspace, hpcloud, and a devstack. Those are all pretty easy to test.

Reply to this email directly or view it on GitHub:
#51 (comment)

@justinclayton

This comment has been minimized.

Contributor

justinclayton commented Jan 8, 2015

+1. Is progress on various components of this provider being tracked somewhere?

@jtopjian

This comment has been minimized.

Contributor

jtopjian commented Jan 25, 2015

If anyone is interested, I did a little weekend project of taking the current state of @haklop's work, broke it out into a dedicated repository, and updated some of it to work with the latest version of gophercloud:

https://github.com/jtopjian/terraform-provider-openstack

@keithchambers

This comment has been minimized.

keithchambers commented Jan 25, 2015

Definitely interested. Thank you for sharing!

@jrperritt jrperritt referenced this issue Feb 4, 2015

Merged

OpenStack Provider #924

3 of 5 tasks complete

@phinze phinze closed this in #924 Mar 31, 2015

@drnic

This comment has been minimized.

Contributor

drnic commented Mar 31, 2015

Boom shakalaka!

On Tue, Mar 31, 2015 at 2:58 PM, Paul Hinze notifications@github.com
wrote:

Closed #51 via #924.

Reply to this email directly or view it on GitHub:
#51 (comment)

@nibalizer

This comment has been minimized.

Contributor

nibalizer commented Mar 31, 2015

woot!

@justinclayton

This comment has been minimized.

Contributor

justinclayton commented Apr 1, 2015

Applause to all involved!

On Tue, Mar 31, 2015 at 3:40 PM -0700, "Spencer Krum" notifications@github.com wrote:

woot!


Reply to this email directly or view it on GitHub.

@zzamboni

This comment has been minimized.

zzamboni commented Apr 1, 2015

Great stuff, thanks!

@tfhartmann

This comment has been minimized.

tfhartmann commented Apr 1, 2015

Nice work!!!

:shipit:

@ehaselwanter

This comment has been minimized.

ehaselwanter commented Apr 1, 2015

Awesome!

@lalloni

This comment has been minimized.

Contributor

lalloni commented Apr 2, 2015

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment