gomorpheus / terraform-provider-morpheus

Terraform Morpheus provider
MIT License
16 stars 20 forks source link

Unable to create morpheus_standard_cloud resource on v7 #249

Open markphelan opened 1 month ago

markphelan commented 1 month ago

We are no longer able to create these resources since upgrading Morpheus to 7.0.3. We were previously able to apply configuration when running v6.

An example of the resource:

// Create TEST Cloud
resource "morpheus_standard_cloud" "test-cloud" {
  name                       = "TF TEST"
  code                       = "tf_test"
  visibility                 = "private"
  enabled                    = true
  automatically_power_on_vms = false
  import_existing_vms        = false
}

The response:

│ Error: You do not have permissions to access this api endpoint
│
│   with morpheus_standard_cloud.test-cloud,
│   on main.tf line 13, in resource "morpheus_standard_cloud" "test-cloud":
│   13: resource "morpheus_standard_cloud" "test-cloud" {

We are still able to create clouds via the UI and via Ansible (utilising the API).

The following error appears to be logged in Morpheus when this error occurs, I'm unsure if it's related:

Forwarding to error page from request [/api/zones] due to exception [Model variable [msg] with value [An error occurred while initializing the Cloud object references an unsaved transient instance - save the transient instance before flushing: com.bertramlabs.plugins.Account] of type [org.codehaus.groovy.runtime.GStringImpl] is not of the correct type [java.lang.String]]
martezr commented 1 month ago

I'm continuing to dig further into the issue but it looks like it might be an enforcement of the group id being required during the creation of the cloud which wasn't strictly enforced in previous versions. Currently working through the best UX in the event that a default Morpheus group needs to be associated with the cloud and how that overlaps with the morpheus_group resource and the clouds associated there.