opentelekomcloud / terraform-otc

Terraform integration modules for Open Telekom Cloud
22 stars 19 forks source link

Got error when creating an instance on OTC #1

Closed junessi closed 7 years ago

junessi commented 8 years ago

I was trying to deploy infrastructures with the code you provided, just replaced my credentials, but I got this error:

openstack_networking_network_v2.tf-net: Creating...
  admin_state_up: "" => "true"
  name:           "" => "myvpc2"
  shared:         "" => "<computed>"
  tenant_id:      "" => "<computed>"
openstack_compute_secgroup_v2.secgroup_1: Creating...
  description:                  "" => "my security group"
  name:                         "" => "my_secgroup"
  rule.#:                       "0" => "1"
  rule.836640770.cidr:          "" => "0.0.0.0/0"
  rule.836640770.from_group_id: "" => ""
  rule.836640770.from_port:     "" => "22"
  rule.836640770.id:            "" => "<computed>"
  rule.836640770.ip_protocol:   "" => "tcp"
  rule.836640770.self:          "" => "false"
  rule.836640770.to_port:       "" => "22"
openstack_compute_secgroup_v2.secgroup_1: Creation complete
openstack_networking_network_v2.tf-net: Creation complete
openstack_networking_subnet_v2.tf-subnet: Creating...
  cidr:        "" => "10.7.0.0/16"
  enable_dhcp: "" => "true"
  gateway_ip:  "" => "10.7.0.1"
  ip_version:  "" => "4"
  name:        "" => "tf-subnet"
  network_id:  "" => "3e620335-87a0-4fd8-98d5-85bc391d4921"
  tenant_id:   "" => "<computed>"
openstack_networking_subnet_v2.tf-subnet: Creation complete
openstack_networking_port_v2.port_1: Creating...
  admin_state_up:                "" => "true"
  device_id:                     "" => "<computed>"
  device_owner:                  "" => "<computed>"
  fixed_ip.#:                    "" => "1"
  fixed_ip.0.ip_address:         "" => "<computed>"
  fixed_ip.0.subnet_id:          "" => "3edfe536-90ae-4b45-bb64-7d7b8b003237"
  mac_address:                   "" => "<computed>"
  name:                          "" => "port_1"
  network_id:                    "" => "3e620335-87a0-4fd8-98d5-85bc391d4921"
  security_group_ids.#:          "" => "1"
  security_group_ids.1986013307: "" => "8d61fc05-3239-4c43-9bc9-83e0e917dbfc"
  tenant_id:                     "" => "<computed>"
openstack_networking_port_v2.port_1: Creation complete
openstack_compute_instance_v2.tf-instance: Creating...
  access_ip_v4:               "" => "<computed>"
  access_ip_v6:               "" => "<computed>"
  flavor_id:                  "" => "<computed>"
  flavor_name:                "" => "m1.medium"
  image_id:                   "" => "<computed>"
  image_name:                 "" => "Standard_CentOS_7.2_latest"
  name:                       "" => "tf-instance"
  network.#:                  "" => "1"
  network.0.access_network:   "" => "false"
  network.0.fixed_ip_v4:      "" => "<computed>"
  network.0.fixed_ip_v6:      "" => "<computed>"
  network.0.floating_ip:      "" => "<computed>"
  network.0.mac:              "" => "<computed>"
  network.0.name:             "" => "<computed>"
  network.0.port:             "" => "3767fc6e-e92f-4942-bb5a-d543b3eac9bd"
  network.0.uuid:             "" => "<computed>"
  security_groups.#:          "" => "1"
  security_groups.1986013307: "" => "8d61fc05-3239-4c43-9bc9-83e0e917dbfc"
  stop_before_destroy:        "" => "false"
  volume.#:                   "" => "<computed>"
openstack_compute_instance_v2.tf-instance: Still creating... (10s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (20s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (30s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (40s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (50s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (1m0s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (1m10s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (1m20s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (1m30s elapsed)
openstack_compute_instance_v2.tf-instance: Still creating... (1m40s elapsed)
Error applying plan:

1 error(s) occurred:

* openstack_compute_instance_v2.tf-instance: Error waiting for instance (698ac43c-36f0-4ddd-a17e-a8848bf8d4da) to become ready: unexpected state 'ERROR', wanted target 'ACTIVE'. last error: %!s(<nil>)

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Everything was fine except the instance, did you meet this error before? or do you have any solution?

zonorti commented 8 years ago

I've hit the same thing. Instance is the main part of all the cloud.

junessi commented 8 years ago

hi, I fixed it by changing the line 1290 of builtin/providers/openstack/resource_openstack_compute_instance_v2.go from imageId := server.Image["id"].(string) to imageId := server.ID

see my repo: https://github.com/cricketlong/terraform

example code:

provider "openstack" {
    user_name = "<your username>"
    password = "<your password>"
    tenant_name = "eu-de"
    domain_name = "OTC00000000001000000XXX"
    auth_url = "https://iam.eu-de.otc.t-systems.com:443/v3"
}

resource "openstack_compute_keypair_v2" "test" {
    name = "testkey0"
    public_key = "<your public key>"
}

resource "openstack_compute_instance_v2" "test" {
    name = "lamp"
    region = "eu-de"
    flavor_name = "s1.medium"
    image_id = "de96e213-ba92-4ed9-af21-3edc43c6a4ad"
    admin_pass = "password123$"
    key_pair = "${openstack_compute_keypair_v2.test.name}"

    network {
        uuid = "dd834465-98f1-47ab-8da0-8f8465bd24b3"
        access_network = true
    }
}
zsoltn commented 7 years ago

Please use the 1.1 code.