Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opennebula_templates: name_regex not working #470

Closed
deynekoaa opened this issue Jul 17, 2023 · 0 comments · Fixed by #471
Closed

opennebula_templates: name_regex not working #470

deynekoaa opened this issue Jul 17, 2023 · 0 comments · Fixed by #471

Comments

@deynekoaa
Copy link

Description

  1. Searching by name_regex not working
data "opennebula_templates" "found_templates" {
  name_regex = "^.*centos-7.*$"
  has_cpu    = true
  sort_on   = "register_date"
  order      = "ASC"
}

On every input it return:

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: templates filtering failed
│
│   with data.opennebula_templates.found_templates,
│   on main.tf line 21, in data "opennebula_templates" "found_templates":
│   21: data "opennebula_templates" "found_templates" {
│
│ no templates match the constraints
╵
  1. In doc option sort_on declareted twise. It's error. Should be:
data "opennebula_templates" "example" {
  name_regex = "test.*"
  has_cpu    = true
  sort_on    = "register_date"
  order       = "ASC"
}
  1. In doc option order should be in uppercase accoding code. I.e.:
* `order` - (Optional) Ordering of the sort: ASC or DESC.

Terraform and Provider version

# terraform -v
2023-07-17T18:59:15.797Z [INFO]  Terraform version: 1.5.3
2023-07-17T18:59:15.798Z [INFO]  Go runtime version: go1.20
2023-07-17T18:59:15.798Z [INFO]  CLI args: []string{"terraform", "-v"}
2023-07-17T18:59:15.799Z [INFO]  CLI command args: []string{"version", "-v"}
Terraform v1.5.3
on linux_amd64
+ provider registry.terraform.io/opennebula/opennebula v1.2.2

Affected resources and data sources

opennebula_templates

Terraform configuration

terraform {
  required_providers {
    opennebula = {
      source = "OpenNebula/opennebula"
      version = "~> 1.2.2"
    }
  }
}

provider "opennebula" {
 endpoint      = "my_nebula"
}

data "opennebula_templates" "found_templates" {
  name_regex = ".*centos-7.*$"
  has_cpu    = true
  sort_on   = "register_date"
  order      = "ASC"
}

resource "opennebula_virtual_machine" "example2" {
  name        = "test2"
  description = "VM"
  memory      = 64
  cpu         = 1

  template_id = data.opennebula_templates.found_templates.templates[0].id
}


### Expected behavior

Template should be found

### Actual behavior

Planning failed. Terraform encountered an error while generating this plan.


│ Error: templates filtering failed

│ with data.opennebula_templates.found_templates,
│ on main.tf line 21, in data "opennebula_templates" "found_templates":
│ 21: data "opennebula_templates" "found_templates" {

│ no templates match the constraints


### Steps to Reproduce

Just try to search templates by regexp

### Debug output

_No response_

### Panic output

_No response_

### Important factoids

_No response_

### References

https://github.com/OpenNebula/terraform-provider-opennebula/issues/322
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants