vmware / terraform-provider-vra

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

[Missing Feature] - Fetch & Add CloudTemplates to newly created project #275

Closed VickyWinner closed 2 years ago

VickyWinner commented 4 years ago

vRA version vRealize Orchestrator 8.2.0.16941495

Terraform version Terraform v0.13.1

terraform-provider-vra plugin version terraform.io/vmware/vra v0.3.3

Is your feature request related to a problem? Please describe. I have pre-created cloud templates in vRA using UI. I am creating a TF module to create project on use basis and tag pre-created cloud templates to newly created project.

Describe the solution you'd like I am looking a way to tag existing cloudTemplates to newly created project. I see currently there is an API endpoint /catalog/api/admin/entitlements using which we can do this but I am looking for a data source in terraform to fetch existing cloud template and assign to a new project created using Terraform.

Describe alternatives you've considered using an API endpoint /catalog/api/admin/entitlements

Additional context

github-actions[bot] commented 3 years ago

Marking this issue as stale due to inactivity. This helps us focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

VickyWinner commented 3 years ago

need this feature.

Prativa20 commented 3 years ago

@VickyWinner Need some clarification. Are you looking for a data source for catalog item?

VickyWinner commented 3 years ago

@Prativa20 data source for catalog item already exists, however, I cannot create entitlement using it. right now I am creating entitlement using below method. However, this way I get all the cloud templates from the project. I am looking for creating entitlement from a catalog item by its name so that I can create entitlements based on its name, not based on the project in which the catalog exists. did I make sense?

data "vra_project" "project_template" {
  name = var.project_template
}

data "vra_catalog_source_blueprint" "this" {
  project_id = data.vra_project.project_template.id
}

data "vra_project" "this" {
  count      = var.project_count
  name       = vra_project.this[count.index].name
  depends_on = [vra_project.this]
}

resource "vra_catalog_source_entitlement" "this" {
  count             = var.project_count
  catalog_source_id = data.vra_catalog_source_blueprint.this.id
  project_id        = data.vra_project.this[count.index].id
}
VickyWinner commented 3 years ago

@Prativa20 Was that clarification helpful? Is this being considered as an valid enhancement?

frodenas commented 2 years ago

This is being added as part of #425, you will have the ability to create a catalog_item_entitlement for a particular catalog_item:

data "vra_catalog_item" "this" {
  name  = vra_blueprint.this.name
}

resource "vra_catalog_item_entitlement" "this" {
  catalog_item_id = data.vra_catalog_item.this.id
  project_id      = var.vra_project_id
}
VickyWinner commented 2 years ago

@frodenas, Well, I moved to an alternate process outside Terraform. couldn't wait this long as we need to create/manage projects using automation.

frodenas commented 2 years ago

The catalog_item_entitlement datasource and resource have been delivered as part of v0.5.0.