OpenNebula / terraform-provider-opennebula

Terraform provider for OpenNebula
https://www.terraform.io/docs/providers/opennebula/
Mozilla Public License 2.0
63 stars 52 forks source link

F-476: add marketplace app resource #489

Closed treywelsh closed 11 months ago

treywelsh commented 1 year ago

Community Note

Description

Add marketplace appliance resource and datasource

References

close #476

New or Affected Resource(s)

Checklist

treywelsh commented 1 year ago

TODO: add tests, doc, changelog Note: in the appliance template there's a TAGS section:TAGS><![CDATA[alpine, kubernetes, service, vnf]]></TAGS> This could be misleading, as said in this issue: https://github.com/OpenNebula/terraform-provider-opennebula/issues/478

treywelsh commented 1 year ago

I have a small problem: I tried to create an app with this TF:

resource "opennebula_marketplace_app" "example" {
  name = "test"
  market_id = "122"
  type = "IMAGE"
  description = "this is an app"
  publisher = "toto"
  version = "0.1.0"
  vmtemplate64 = "REVTQz0idGhpcyBpcyBhIHZtIHRlbXBsYXRlIgo="
  apptemplate64 = "REVTQz0idGhpcyBpcyBhbiBhcHAgdGVtcGxhdGUiCg=="

  tags = {
    custom1 = "value1"
  }
}

It's surely broken, however the create method returns an error and doesn't returns an ID but the app is created in OpenNebula and has ERROR state. The provider should be able to delete the application but is not without having the app ID. The XML-RPC method has a return field either used to return an ID, or the error string, it's probably why we don't get an ID but an error message instead. Should the resource be created then ?

To fix this and be able to retrieve the ID, we could add to the appliance a custom field containing an ID string used to identify the resource created, the provider could juste remove this ID later. I already did something like this for the virtual router instances

treywelsh commented 1 year ago

Depends on https://github.com/OpenNebula/one/pull/6312

treywelsh commented 12 months ago

5.12 release tests fails because in the acceptance test config I'm testing an appliance type that wasn't supported. I'm trying to make the acceptance tests for 5.12 to ignore this error to make them pass