Could not start Openstack instance from Terraform

I am trying to create an instance of OpenStack using Terraform, but I am getting the following error:

Error applying plan: 1 error(s) occurred: * openstack_compute_instance_v2.basic: Error creating OpenStack server: Invalid request due to incorrect syntax or missing required parameters. Terraform does not automatically rollback in the face of errors. Instead, your Terraform state file has been partially updated with 

but the same Terraform code successfully creates a security group, a pair of keys and volumes in my OpenStack account

Here is my Terraform code:

 provider "openstack" { user_name = "admin" tenant_name = "admin" password = "admin" auth_url = "http://my_IP():5000/v2.0" } resource "openstack_blockstorage_volume_v1" "myvol" { name = "myvol" size = 1 } resource "openstack_compute_instance_v2" "basic" { name = "basic" image_id = "8ce1c922-ad0-81a3-823ea1b0af9b" flavor_id = "2" key_pair = "tf-keypair-1" security_groups = ["default"] metadata { this = "that" } network { name = "8b510300-610a--9cc3-6e76e33395b4" } volume { volume_id = "${openstack_blockstorage_volume_v1.myvol.id}" } } 
+5
source share
3 answers

This post was pretty hard to debug until recently. In version 0.8.8 of Terraform (more specifically, Enable HTTP protocol enhancement for the OpenStack Terraform provider) , the team added the OS_DEBUG environment variable to help provide additional information in such cases. One way to use it is as follows:

 TF_LOG=DEBUG OS_DEBUG=1 terraform apply ... 

As soon as I got this message, because I forgot to add the ssh key in OpenStack for the user I used.

+8
source

You should carefully check all your parameters for typos and / or incorrect values. TF does not do this for you.

This happens when you specify, for example, a non-existent key pair or network name (for example, in your example, you specified an ID instead of a name for the network).

0
source

From your configuration:

network { name = "8b510300-610a--9cc3-6e76e33395b4" }

You assign name but provide network id .

0
source

Source: https://habr.com/ru/post/1259894/


All Articles