Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for manageability of multiple storage profiles #335

Open
brude-softserve opened this issue Apr 30, 2021 · 1 comment
Open

Add support for manageability of multiple storage profiles #335

brude-softserve opened this issue Apr 30, 2021 · 1 comment
Labels
enhancement Enhancement

Comments

@brude-softserve
Copy link

vRA version
v8
Terraform version
v0.14.9
terraform-provider-vra plugin version
v0.3.5

Is your feature request related to a problem? Please describe.
Current examples of storage profiles show only a single-profile use-case while in real environments it's needed to manage multiple storage profiles. Each storage profile relies on the vra_fabric_datastore_vsphere and vra_fabric_storage_policy_vsphere data sources so you need to keep track of three different loops and create some connections between them which makes the code heavier and more error-prone. For example, this is the workaround we have to use:

data "vra_fabric_datastore_vsphere" "this" {
  for_each = {
    for key, profile in var.storage_profiles :
    key => profile
    if profile.datastore != "Any"
  }
  filter = "name eq '${each.value.datastore}'"
}
data "vra_fabric_storage_policy_vsphere" "this" {
  for_each = {
    for key, profile in var.storage_profiles :
    key => profile
    if profile.storage_policy != "Default"
  }
  filter = "name eq '${each.value.storage_policy}'"
}
resource "vra_storage_profile" "this" {
  for_each    = var.storage_profiles
  name        = each.key
  description = "Storage Profile"
  region_id = var.region_id
  default_item = each.value.default
  disk_properties = each.value.disk_properties
  disk_target_properties = {
    datastoreId     = each.value.datastore != "Any" ? data.vra_fabric_datastore_vsphere.this[each.key].id : null
    storagePolicyId = each.value.storage_policy != "Default" ? data.vra_fabric_storage_policy_vsphere.this[each.key].id : null
  }
}

Describe the solution you'd like
It would be great if it was possible to set the datastore name and policy within the vra_storage_profile resource definition, for example:

resource "vra_storage_profile" "this" {
  name        =  "storage_profile1"
  description = "Storage Profile 1"
  region_id = var.region_id
  default_item = true
  disk_properties = { 
      provisioningType = "thin"
  }
  disk_target_properties = {
    datastoreName     =  "datastore-1"
    storagePolicyName = "Default"
  }
}
@brude-softserve brude-softserve added the enhancement Enhancement label Apr 30, 2021
@github-actions
Copy link

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!

@github-actions github-actions bot added the stale Stale label Jul 22, 2021
@frodenas frodenas added needs-triage Needs Triage and removed stale Stale labels Jul 22, 2021
@tenthirtyam tenthirtyam changed the title More manageability for multiple storage profiles Add support for manageability of multiple storage profiles Jul 10, 2024
@tenthirtyam tenthirtyam removed the needs-triage Needs Triage label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants