gomorpheus / terraform-provider-morpheus

Terraform Morpheus provider
MIT License
17 stars 23 forks source link

Plugin Crashes on Windows Server 2019 #294

Open RedRaikiri opened 1 day ago

RedRaikiri commented 1 day ago

Dear community, dear developers,

due to missing possibilities I am trying to run the provider from a Windows-Server-Instance. As an addition: it is an experiment from my point of view. I did a really basic setup and have no chance to apply any of my changes. Terraform init and plan went flawless.

Because the issue persits in Version 0.11.0 (started trying on version 0.9.8, continued on 0.10.0) I´m reporting the issue now. CPU Runs on 2,79GHz and the system has 16GB of RAM. A 64bits Version of Windows Server 2019 Version 1809 is running. OS-Build: 17763.6414. The instance is not allowed to connect to the internet. Downloaded the provider from another device or directly from the repo.

Due to offline requirement I followed this setup for the environment: https://somspeaks.com/terraform-offline-setup-and-initialization/

I am not reporting issues that often. If you have any questions I will try to answer as soon as possible.

Now the Error-Code:
morpheus_vsphere_instance.tf_example_vsphere_instance: Creating... 
╷ 
│ Error: Plugin did not respond
│
│   with morpheus_vsphere_instance.tf_example_vsphere_instance,
│   on main.tf line 50, in resource "morpheus_vsphere_instance" "tf_example_vsphere_instance":
│   50: resource "morpheus_vsphere_instance" "tf_example_vsphere_instance" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-morpheus_v0.11.0.exe plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x2c pc=0xaf359e]

goroutine 58 [running]:
github.com/gomorpheus/terraform-provider-morpheus/morpheus.resourceVsphereInstanceCreate({0xe62a40, 0xc073d10}, 0xc073cc0, {0xcdd8a0, 0xc318280})
        github.com/gomorpheus/terraform-provider-morpheus/morpheus/resource_vsphere_instance.go:307 +0x25e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc392850, {0xe629e0, 0xc685368}, 0xc073cc0, {0xcdd8a0, 0xc318280})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/resource.go:806 +0x11d
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc392850, {0xe629e0, 0xc685368}, 0xc528af0, 0xc073bd0, {0xcdd8a0, 0xc318280})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/resource.go:937 +0xaa2
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc2bce40, {0xe629e0, 0xc685320}, 0xc31ff20)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.34.0/helper/schema/grpc_provider.go:1153 +0xf46
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc072690, {0xe629e0, 0xc685038}, 0xc178ec0)
        github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/tf5server/server.go:865 +0x424
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0xca14e0, 0xc072690}, {0xe629e0, 0xc685038}, 0xc178e80, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x176
google.golang.org/grpc.(*Server).processUnaryRPC(0xc090780, {0xe629e0, 0xc685008}, {0xe6459c, 0xc252000}, 0xc0800a0, 0xc2f8b28, 0x1476ecc, 0x0)
        google.golang.org/grpc@v1.63.2/server.go:1369 +0xf89
google.golang.org/grpc.(*Server).handleStream(0xc090780, {0xe6459c, 0xc252000}, 0xc0800a0)
        google.golang.org/grpc@v1.63.2/server.go:1780 +0x1108
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.63.2/server.go:1019 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 36
        google.golang.org/grpc@v1.63.2/server.go:1030 +0x13f

Error: The terraform-provider-morpheus_v0.11.0.exe plugin crashed!

Code is pretty basic:

terraform {
  required_providers {
    morpheus = {
      source  = "gomorpheus/morpheus"
      version = "0.11.0"
    }
  }
}

provider "morpheus" {
  url          = var.morpheus_url
  #username = var.morpheus_username
  #password = var.morpheus_password
  access_token = var.morpheus_access_token
  #tenant_subdomain = "<censored>" -> not needed when using access_token
}

resource "morpheus_vsphere_instance" "tf_example_vsphere_instance" {
  name               = "terraformTest"
  description        = "terraform Test"
  cloud_id           = "<censored>" #data.morpheus_cloud.morpheus_vsphere.id
  group_id           = "<censored>" #data.morpheus_group.<censored>_group.id
  instance_type_id   = "<censored>" #data.morpheus_instance_type.RHEL_Server_<censored>.id
  instance_layout_id = "<censored>" #data.morpheus_instance_layout.RHEL9.id
  plan_id            = "<censored>" #data.morpheus_plan.vmware.id
  environment        = "<censored>"
  resource_pool_id   = "<censored>" #data.morpheus_resource_pool.ressourcePoolOne.id
  #labels = ["demo", "terraform"]

  interfaces {
    network_id = "<censored>" #data.morpheus_network.vmnetwork.id
  }

  #  tags {
  #    name = "tf"
  #  }

  evar {
    name   = "application"
    value  = "demo"
    export = true
    masked = true
  }
}

Hope this helps.