Skip to content

[Enhancement]: Add aggregate available storage as property of data sources #256

@pgsmith123

Description

@pgsmith123

Description

With our self service automation portal we select the aggregate with the most available free space to deploy volumes on to. I would like to be able to use the aggregate.space.block_storage.available property or other properties to see how much free space is available on an aggregate.

Affected Resource(s) and/or Data Source(s)

netapp-ontap_storage_aggregate_data_source
netapp-ontap_storage_aggregates_data_source

Potential Terraform Configuration

data "netapp-ontap_storage_aggregates_data_source" "storage_aggregates" {
    # required to know which system to interface with
    cx_profile_name = var.storage_tier
}

locals {
    aggregates = data.netapp-ontap_storage_aggregates_data_source.storage_aggregates.storage_aggregates
    max = max(local.aggregates[*].space.block_storage.available...)
    aggregate = local.aggregates[index(local.aggregates.*.space.block_storage.available, max)]
}

resource "netapp-ontap_storage_volume_resource" "volume" {
  cx_profile_name = var.storage_tier
  name = local.volume_name
  comment = jsonencode({"shareName" = var.share_name, "customerNumber" = var.customer_number})
  svm_name = local.svm
  qos_policy_group = local.qos_policy
  aggregates = [
    {
      name = local.aggregate.name
    }
  ]
  space_guarantee = "none"
  snapshot_policy = var.snapshot_policy
  space = {
      size = var.volume_size
      size_unit = "gb"
      percent_snapshot_space = 5
    logical_space = {
      enforcement = true
      reporting = true
    }
  }
  nas = {
    export_policy_name = var.export_policy_name
    junction_path = "/${lower(var.share_name)}"
  }
  efficiency = {
    policy_name = "default"
  }
}

References

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

2.2

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions