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

Applying opennebula_host crashes when host is tainted #399

Closed
frousselet opened this issue Jan 26, 2023 · 0 comments · Fixed by #400
Closed

Applying opennebula_host crashes when host is tainted #399

frousselet opened this issue Jan 26, 2023 · 0 comments · Fixed by #400

Comments

@frousselet
Copy link
Collaborator

frousselet commented Jan 26, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.3.5
on darwin_arm64

Provider 1.1.1-rc3

Affected Resource(s)

  • opennebula_xxx

Terraform Configuration Files

terraform {
  required_providers {
    opennebula = {
      source = "one.test/one/opennebula"
    }
  }
}

provider "opennebula" {
  endpoint = "https://one/RPC2"
  username = "toto"
  password = "toto"
  insecure = true
}

resource "opennebula_host" "example" {
  name       = "toto.net"
  type       = "kvm"
  cluster_id = opennebula_cluster.example.id

  # overcommit {
  #   cpu    = 9999999999999
  #   memory = 9999999999999
  # }
}

resource "opennebula_datastore" "example" {
  name = "lulu"
  type = "image"

  cluster_ids = [opennebula_cluster.example.id]

  custom {
    datastore = "dummy"
    transfer  = "dummy"
  }

  tags = {
    environment = "test"
  }
}

resource "opennebula_cluster" "example" {
  name = "test"

  tags = {
    environment = "example"
  }

  template_section {
    name = "test"
    elements = {
      tag1 = "value1"
    }
  }

  lifecycle {
    ignore_changes = [
      datastores,
      hosts,
      virtual_networks
    ]
  }

}

resource "opennebula_group" "example" {
  name = "eee"

  quotas {
    datastore_quotas {
      id     = 1
      images = 3
      size   = 10000
    }
    vm_quotas {
      cpu            = 3
      running_cpu    = 3
      memory         = 2048
      running_memory = 2048
    }
    network_quotas {
      id     = 10
      leases = 6
    }
    network_quotas {
      id     = 11
      leases = 4
    }
    image_quotas {
      id          = 8
      running_vms = 1
    }
    image_quotas {
      id          = 9
      running_vms = 1
    }
  }
}

resource "opennebula_virtual_network" "example" {
  name            = "virtual-network"
  permissions     = "660"
  group           = opennebula_group.example.name
  bridge          = "br0"
  physical_device = "eth0"
  type            = "fw"
  mtu             = 1500
  dns             = "172.16.100.1"
  gateway         = "172.16.100.1"
  security_groups = [0]
  cluster_ids     = [opennebula_cluster.example.id]
}

resource "opennebula_virtual_network_address_range" "test" {
  virtual_network_id = opennebula_virtual_network.example.id
  ar_type            = "IP4"
  mac                = "02:00:ac:10:64:6e"
  size               = 15
  ip4                = "172.16.100.110"

  hold_ips = ["172.16.100.112", "172.16.100.114"]
}

Debug Output

> terraform apply

opennebula_host.example: Refreshing state... [id=13]
opennebula_cluster.example: Refreshing state... [id=105]
opennebula_group.example: Refreshing state... [id=105]
╷
│ Warning: Deprecated attribute
│ 
│   on main.tf line 59, in resource "opennebula_cluster" "example":
│   59:       datastores,
│ 
│ The attribute "datastores" is deprecated. Refer to the provider documentation for details.
│ 
│ (and 2 more similar warnings elsewhere)
╵
╷
│ Error: Plugin did not respond
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with opennebula_cluster.example,
│   on main.tf line 43, in resource "opennebula_cluster" "example":
│   43: resource "opennebula_cluster" "example" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with opennebula_group.example,
│   on main.tf line 67, in resource "opennebula_group" "example":
│   67: resource "opennebula_group" "example" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ReadResource call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-opennebula plugin:

panic: set item just set doesn't exist

goroutine 102 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).setSet(0x1400064ff08, {0x14000592810, 0x1, 0x1}, {0x1056033c0, 0x1400064ffc8}, 0x1400046bb80)
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/field_writer_map.go:328 +0x7d4
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).set(0x1400064ff08, {0x14000592810, 0x1, 0x1}, {0x1056033c0, 0x1400064ffc8})
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/field_writer_map.go:107 +0x120
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*MapFieldWriter).WriteField(0x1400064ff08, {0x14000592810, 0x1, 0x1}, {0x1056033c0, 0x1400064ffc8})
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/field_writer_map.go:89 +0x38c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).Set(0x140007ab880, {0x105466aa7, 0xa}, {0x1056033c0, 0x1400064ffc8})
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource_data.go:227 +0x20c
github.com/OpenNebula/terraform-provider-opennebula/opennebula.resourceOpennebulaHostRead({0x105732d80?, 0x14000289f00?}, 0x140007ab880, {0x1055ee980?, 0x14000616940})
	/Users/frousselet/Projets/github/opennebula/terraform-provider-opennebula/opennebula/resource_opennebula_host.go:346 +0x4dc
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x140004535e0, {0x105732d80, 0x14000289f00}, 0x24?, {0x1055ee980, 0x14000616940})
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:358 +0xe8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0x140004535e0, {0x105732d80, 0x14000289f00}, 0x14000396d00, {0x1055ee980, 0x14000616940})
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/resource.go:635 +0x30c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0x140002de840, {0x105732d80, 0x14000289f00}, 0x14000289f80)
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/v2@v2.10.1/helper/schema/grpc_provider.go:576 +0x3cc
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0x1400011a200, {0x105732e28?, 0x140003566c0?}, 0x140003aa4e0)
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/tf5server/server.go:553 +0x310
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x1056fa480?, 0x1400011a200}, {0x105732e28, 0x140003566c0}, 0x140003aa480, 0x0)
	/Users/frousselet/go/pkg/mod/github.com/hashicorp/terraform-plugin-go@v0.5.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:344 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400037efc0, {0x105736d20, 0x140000e2000}, 0x14000542100, 0x14000111b60, 0x105c014b0, 0x0)
	/Users/frousselet/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1194 +0xadc
google.golang.org/grpc.(*Server).handleStream(0x1400037efc0, {0x105736d20, 0x140000e2000}, 0x14000542100, 0x0)
	/Users/frousselet/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:1517 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	/Users/frousselet/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:859 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
	/Users/frousselet/go/pkg/mod/google.golang.org/grpc@v1.32.0/server.go:857 +0x290

Error: The terraform-provider-opennebula plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000
@frousselet frousselet added this to the 1.1.1 milestone Jan 26, 2023
@frousselet frousselet changed the title Applying opennebula_host crashes Applying opennebula_host crashes when host is tainted Jan 26, 2023
treywelsh added a commit that referenced this issue Jan 26, 2023
frousselet pushed a commit that referenced this issue Jan 26, 2023
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.

1 participant