Search code examples
openstackpackerkeystone

Packer + Openstack: DomainID been asked even after providing it


I am trying to use Packer with Openstack. I've set my enviornmental variables correctly still I am getting error while packer validation.

My json file for packer:

{
"builders":[{
"type": "openstack",
"region": "ap-au-1",
"ssh_username": "root",
"image_name": "kris-packer",
"source_image": "4ead4da5-efc8-48ce-bfa9-********",
"flavor": "2"
}]
}

I am getting below error:

./packer validate test.json
>>Template validation failed. Errors are shown below.
   Errors validating build 'openstack'. 1 error(s) occurred:
   * You must provide exactly one of DomainID or DomainName to authenticate by Username

As per documentation, I have set following environment variables before running packer code:

OS_PROJECT_DOMAIN_ID= OS_PROJECT_ID= OS_USER_DOMAIN_ID= OS_IDENTITY_API_VERSION=3 OS_PASSWORD= OS_AUTH_URL= OS_USERNAME=

I've also tried using OS_XXXX_NAME instead of OS_XXXX_ID and still getting the mentioned error. Can anyone please point what might be going wrong ?

Note: I am successfully able to run commands like openstack image list and perform other actions via CLI. Only issue I am getting is while using packer.


Solution

  • From the Packer documentation:

    OS_TENANT_NAME or OS_TENANT_ID must be used even with Identity v3,OS_PROJECT_NAME and OS_PROJECT_ID has no effect in Packer.

    I expect it to work if you do export OS_TENANT_NAME=$OS_PROJECT_NAME