Failed to create my first OpenStack VM by way of terraform

I am trying to see if I could create OpenStack VMs by terraform for the first time, but so far no luck.

here is what I have in my main.tf file:

...
terraform {
  required_providers {
    openstack = {
      source = "terraform-provider-openstack/openstack"
    }
  }
}

provider "openstack" {
  cloud  = "osp_admin" # cloud defined in cloud.yml file
}

# Variables
variable "keypair" {
  type    = string
  default = "ubuntu"   # name of keypair created
}

variable "network" {
  type    = string
  default = "Public_External_1" # default network to be used
}

variable "security_groups" {
  type    = list(string)
  default = ["default"]  # Name of default security group
}
# Data sources
## Get flavor id
data "openstack_compute_flavor_v2" "flavor" {
  name = "mt.small"                       # flavor to be used
}

## Get Image ID
data "openstack_images_image_v2" "image" {
  name        = "Debian-10"              # Name of image to be used
  most_recent = true
}

And image of "Debian-10" has bee created, as I have verified it from image list. Now If I was running this on my command line.

terraform plan 

I have got such message in return:

data.openstack_images_image_v2.image: Reading...
data.openstack_compute_flavor_v2.flavor: Reading...
╷
│ Error: Error creating OpenStack compute client: Post "http://van3-st-vn-01.corp.<domain_name>.com:5000/v3/auth/tokens": OpenStack connection error, retries exhausted. Aborting. Last error was: EOF
│
│   with data.openstack_compute_flavor_v2.flavor,
│   on main.tf line 32, in data "openstack_compute_flavor_v2" "flavor":
│   32: data "openstack_compute_flavor_v2" "flavor" {
│
╵
╷
│ Error: Error creating OpenStack image client: Post "http://van3-st-vn-01.corp.<domain_name>.com:5000/v3/auth/tokens": OpenStack connection error, retries exhausted. Aborting. Last error was: EOF
│
│   with data.openstack_images_image_v2.image,
│   on main.tf line 37, in data "openstack_images_image_v2" "image":
│   37: data "openstack_images_image_v2" "image" {
│
╵

I was running terraform on ubuntu 22.04, and here is the terraform version message:

/usr/bin/terraform --version
Terraform v1.2.9
on linux_amd64
+ provider registry.terraform.io/terraform-provider-openstack/openstack v1.48.0

If I was to log-in OpenStack, I was able to create this instance with the same set of parameters.

Any ideas what I did wrong here ?

Thanks,

Chun

update:

curl -v http://van3-st-vn-01.corp.<domain_name>.com:5000/v3/auth/tokens
*   Trying 10.95.36.130:5000...
* TCP_NODELAY set
* Connected to van3-st-vn-01.corp.<domain_name>.com (10.95.36.130) port 5000 (#0)
> GET /v3/auth/tokens HTTP/1.1
> Host: van3-st-vn-01.corp.<domain_name>.com:5000
> User-Agent: curl/7.68.0
> Accept: */*
>
* Empty reply from server
* Connection #0 to host van3-st-vn-01.corp.<domain_name>.com left intact
curl: (52) Empty reply from server


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation