How use the packer in openstack to create a vm debian 11 instance

I’m trying to use packer with openstack (https://developer.hashicorp.com/packer/plugins/builders/openstack) to create a “debian 11” instance.

I’m trying to configure but I always get an ssh timeout error.
This is my build file:


packer {
  required_plugins {
    openstack = {
      version = ">= 1.0.0"
      source  = "github.com/hashicorp/openstack"
    }
  }
}
variable "openstack_node_name" {
  type = string
}

source "openstack" "debian-docker" {

  image_name   = "sbc-node-${var.openstack_node_name}"
  source_image = "9f6eb69a-a23e-4916-80df-7d3e6882b43a"

  flavor = "m1.medium"
  cloud  = "openstack"

  metadata = {
    app_vendor  = "nerd4ever"
    app_name    = "sbc-api"
    app_version = "@VERSION@"
    app_date    = "@DATE@"
  }

  domain_name = "Default"
  insecure    = "true"
  region      = "microstack"
  tenant_name = "Default"
  volume_size = "80"

  user_data_file          = "http/user-data"
  ssh_interface           = "private"
  ssh_ip_version          = "4"
  ssh_username            = "test"
  ssh_password            = "#changeIt!"
  floating_ip_network     = "external"

  pause_before_connecting = "10m"
  networks                = [
    "1867ae9c-0c73-49a2-815c-fa8a0c60a742"
  ]
  security_groups = [
    "default"
  ]

  communicator = "ssh"
}

build {
  sources = ["source.openstack.debian-docker"]
}

This is my user_data_file:


#cloud-config
autoinstall:
  version: 1
  locale: en_US
  keyboard:
    layout: us
  ssh:
    install-server: true
    allow-pw: true
  packages:
    - qemu-guest-agent
    - sudo
  storage:
    layout:
      name: direct
    swap:
      size: 0
  user-data:
    package_upgrade: false
    timezone: America/Sao_Paulo
    users:
      - name: test
        groups: [adm, sudo]
        lock-passwd: false
        sudo: ALL=(ALL) NOPASSWD:ALL
        shell: /bin/bash
        passwd: #changeIt!
        # - or -
        # ssh_authorized_keys:
        #   - your-ssh-key

I am using debian-11-generic-amd64-20221020-1174 image. qcow2
(https://cdimage.debian.org/images/cloud/bullseye/20221020-1174/debian-11-generic-amd64-20221020-1174.qcow2)

The instance is created in my openstack (running in a ubuntu 20.04 with the microstack installed by snap), but it is removed when it gives a timeout error ssh.

Output:

openstack.debian-docker: output will be in this color.

==> openstack.debian-docker: Loading flavor: m1.medium
openstack.debian-docker: Verified flavor. ID: 3
==> openstack.debian-docker: Creating temporary RSA SSH key for instance…
==> openstack.debian-docker: Not using temporary keypair
==> openstack.debian-docker: Launching server…
==> openstack.debian-docker: Launching server…
openstack.debian-docker: Server ID: 6589adcc-e8fa-4641-b7a3-e1d0b7a80640
==> openstack.debian-docker: Waiting for server to become ready…
openstack.debian-docker: Floating IP not required
==> openstack.debian-docker: Waiting for SSH to become available…
==> openstack.debian-docker: Timeout waiting for SSH.
==> openstack.debian-docker: Terminating the source server: 6589adcc-e8fa-4641-b7a3-e1d0b7a80640 …
Build ‘openstack.debian-docker’ errored after 5 minutes 20 seconds: Timeout waiting for SSH.

==> Wait completed after 5 minutes 20 seconds

==> Some builds didn’t complete successfully and had errors:
→ openstack.debian-docker: Timeout waiting for SSH.

==> Builds finished but no artifacts were created.

How can I resolve this?