vmware / terraform-provider-vra

Terraform Provider for VMware Aria Automation
https://registry.terraform.io/providers/vmware/vra/
Mozilla Public License 2.0
103 stars 90 forks source link

Include the ability to filter Catalog Items by Project Id #430

Closed thecloudxpert closed 1 year ago

thecloudxpert commented 2 years ago

Code of Conduct

This project has a Code of Conduct that all participants are expected to understand and follow:

Description

When you have multiple catalog items called the same thing (such as Agnostic Machine) in multiple projects, the may have different version associated/released to the catalog. It seems when using the following code:

data "vra_catalog_item" "this" {
  name  = "Agnostic Machine"
}

The provider selects the first catalog item it comes to that matches the name and not the one I was looking for. There is no way to filter the catalog item on the vra_catalog_item via a project so you can choose the right item. You can do this with templates (vra_blueprint), i.e. :

data "vra_project" "this" {
  name = "Demo"
}

data "vra_blueprint" "this" {
  name = "Agnostic Machine"
  project_id = data.vra_project.this.id
}

A catalog item from another project may not have the same version released. Therefore, when creating the deployment and specifying a version, the deployment fails:

resource "vra_deployment" "this" {
  name        = "TF demo"
  description = "Deployed from vRA provider for Terraform OSS"

  catalog_item_id      = data.vra_catalog_item.this.id
  catalog_item_version = "0.0.3"
  project_id           = data.vra_project.this.id

  inputs = {
    cloud = "cloud:vsphere"
    size = "small"
    image = "windows"
  }

  timeouts {
    create = "30m"
    delete = "30m"
    update = "30m"
  }
}

Describe alternatives you've considered

As this was for a demo, i ended up using the blueprint method, but this doesn't get the icon from the catalog item and its equivalent of deploying via cloud assembly not service broker.

References

N/A

Community Note

frodenas commented 1 year ago

Implemented in #461