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

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

Open
pgsmith123 opened this issue Aug 1, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@pgsmith123
Copy link

pgsmith123 commented Aug 1, 2024

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

@pgsmith123 pgsmith123 added the enhancement New feature or request label Aug 1, 2024
@carchi8py carchi8py moved this from Future to 2.1 in Terraform for ONTAP Roadmap Aug 7, 2024
@carchi8py carchi8py added this to the 2.1 milestone Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 2.1
Development

No branches or pull requests

2 participants