I'm having trouble using packer to build a UK Rackspace cloud server resulting in a 401 instead of a 200:
Build 'openstack' errored: Expected HTTP response code ; got 401 instead
I have exported SDK_USERNAME, SDK_PASSWORD with my API credentials and exported SDK_PROVIDER=rackspace-uk
I already use these credentials with other rackspace API tools like pyrax so I know they are correct. I have also set the credentials and provider in the packer json template, but that makes no difference.
Full config details and logs here:
Looking at gophercloud (https://github.com/rackspace/gophercloud/blob/master/global_context.go) I looks like it is using the correct UK API endpoint:
$ packer --version
I'm running packer on Mountain Lion
I'll try to sign up for an account and give this a go..
Somebody else is also seeing this with the rackspace-us provider:
This is due to the authentication method being used. OpenStack expects a username and password, while RAX offers an additional API key variation (slightly different format to specify the use of an API key rather than the password) - http://docs.rackspace.com/servers/api/v2/cs-gettingstarted/content/curl_auth.html (examples 4 and 5, respectively).
I have tested and confirmed this by updating a template file and providing the RAX account password (same one used when accessing the control panel) instead of the API key. Given these are creds that access full account information as well, I'd prefer to see an alternative - I fear that may be in a specific RAX builder/auth section or similar.
For the time being, given the presence of role-based access control for most products, I have created an additional RAX username under my account, permitting me to make requests in the expected OpenStack format - having the added benefit of segregating access roles as well.
+1 for @asmajlovic's proposal
Thansk @asmajlovic that solved the problem. I'll close this now. Probably a good idea to make a note on the packer docs about this.