GithubHelp home page GithubHelp logo

Comments (7)

jaypif avatar jaypif commented on August 25, 2024

Can you share the terraform file and the output from terraform with the error please ?

from terraform-provider-opennebula.

aaachuang avatar aaachuang commented on August 25, 2024
$ terraform init

Initializing the backend...

Initializing provider plugins...
- Using previously-installed terraform-providers/opennebula v0.2.2

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.

* terraform-providers/opennebula: version = "~> 0.2.2"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
$ cat vm.tf
resource "opennebula_virtual_machine" "test0" {
  name        = "test0"
  template_id = 0
}
resource "opennebula_virtual_machine" "test1" {
  name        = "test1"
  template_id = 1
}
$ terraform apply

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # opennebula_virtual_machine.test0 will be created
  + resource "opennebula_virtual_machine" "test0" {
      + cpu         = (known after apply)
      + gid         = (known after apply)
      + gname       = (known after apply)
      + id          = (known after apply)
      + instance    = (known after apply)
      + ip          = (known after apply)
      + lcmstate    = (known after apply)
      + memory      = (known after apply)
      + name        = "test0"
      + pending     = false
      + permissions = (known after apply)
      + state       = (known after apply)
      + template_id = 0
      + timeout     = 3
      + uid         = (known after apply)
      + uname       = (known after apply)
      + vcpu        = (known after apply)

      + disk {
          + driver   = (known after apply)
          + image_id = (known after apply)
          + size     = (known after apply)
          + target   = (known after apply)
        }

      + graphics {
          + keymap = (known after apply)
          + listen = (known after apply)
          + port   = (known after apply)
          + type   = (known after apply)
        }

      + nic {
          + ip              = (known after apply)
          + mac             = (known after apply)
          + model           = (known after apply)
          + network         = (known after apply)
          + network_id      = (known after apply)
          + nic_id          = (known after apply)
          + physical_device = (known after apply)
          + security_groups = (known after apply)
        }

      + os {
          + arch = (known after apply)
          + boot = (known after apply)
        }

      + vmgroup {
          + role       = (known after apply)
          + vmgroup_id = (known after apply)
        }
    }

  # opennebula_virtual_machine.test1 will be created
  + resource "opennebula_virtual_machine" "test1" {
      + cpu         = (known after apply)
      + gid         = (known after apply)
      + gname       = (known after apply)
      + id          = (known after apply)
      + instance    = (known after apply)
      + ip          = (known after apply)
      + lcmstate    = (known after apply)
      + memory      = (known after apply)
      + name        = "test1"
      + pending     = false
      + permissions = (known after apply)
      + state       = (known after apply)
      + template_id = 1
      + timeout     = 3
      + uid         = (known after apply)
      + uname       = (known after apply)
      + vcpu        = (known after apply)

      + disk {
          + driver   = (known after apply)
          + image_id = (known after apply)
          + size     = (known after apply)
          + target   = (known after apply)
        }

      + graphics {
          + keymap = (known after apply)
          + listen = (known after apply)
          + port   = (known after apply)
          + type   = (known after apply)
        }

      + nic {
          + ip              = (known after apply)
          + mac             = (known after apply)
          + model           = (known after apply)
          + network         = (known after apply)
          + network_id      = (known after apply)
          + nic_id          = (known after apply)
          + physical_device = (known after apply)
          + security_groups = (known after apply)
        }

      + os {
          + arch = (known after apply)
          + boot = (known after apply)
        }

      + vmgroup {
          + role       = (known after apply)
          + vmgroup_id = (known after apply)
        }
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

opennebula_virtual_machine.test1: Creating...
opennebula_virtual_machine.test0: Creating...
opennebula_virtual_machine.test1: Still creating... [10s elapsed]
opennebula_virtual_machine.test1: Creation complete after 17s [id=10]

Error: cpu is mandatory as template_id is not used

  on vm.tf line 1, in resource "opennebula_virtual_machine" "test0":
   1: resource "opennebula_virtual_machine" "test0" {

from terraform-provider-opennebula.

aaachuang avatar aaachuang commented on August 25, 2024
$ onetemplate list
  ID USER     GROUP    NAME                                              REGTIME
   2 oneadmin oneadmin ci106                                      11/06 23:01:03
   1 oneadmin oneadmin ci1404                                     11/04 21:03:34
   0 oneadmin oneadmin ci2004                                     11/04 21:03:20
$ onevm list
  ID USER     GROUP    NAME             STAT  CPU     MEM HOST              TIME
  10 oneadmin oneadmin test1            runn    1   1024M 4830t         0d 00h06

from terraform-provider-opennebula.

jaypif avatar jaypif commented on August 25, 2024

OK

This is surprising while test are OK but I will add a better check for the case id = 0.
Thanks

from terraform-provider-opennebula.

aaachuang avatar aaachuang commented on August 25, 2024

i think i ran into the similar error with image_id = 0. please also check on that. thanks.

from terraform-provider-opennebula.

jaypif avatar jaypif commented on August 25, 2024

about the image_id issue: it is already fixed by the PR #75
So in the next release 0.3.0 you should have both fixes

from terraform-provider-opennebula.

aaachuang avatar aaachuang commented on August 25, 2024

thanks.

from terraform-provider-opennebula.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.