Skip to content

Support metadata on subnet V2 resource and data source #1085

@Haroon-Dweikat-Ntx

Description

@Haroon-Dweikat-Ntx

Summary

The Nutanix subnet V2 API supports optional metadata (e.g. category assignments) on subnets. The Terraform provider’s nutanix_subnet_v2 resource and nutanix_subnets_v2 / subnet-related data sources do not expose this field, so users cannot manage or read subnet metadata via Terraform.

Problem

  • Resource: nutanix_subnets_v2 does not accept or persist a metadata block, so category IDs and other metadata cannot be set at create/update time.
  • Data source: The single-subnet data source nutanix_subnet_v2 and the list data source nutanix_subnets_v2 do not expose metadata in their schema, so existing metadata is not visible in state or in other resources that depend on it.

This limits governance and tagging workflows (e.g. assigning categories to subnets) and makes Terraform state inconsistent with the platform when metadata is set outside Terraform.

Proposed solution

  • Add an optional metadata block to the nutanix_subnets_v2 resource schema (e.g. category_ids), consistent with other V2 resources that support metadata.
  • In the resource: pass metadata in create/update payloads and read it back in the read function.
  • Add a computed metadata block to:
    • The single-subnet data source nutanix_subnet_v2
    • The subnets list data source nutanix_subnets_v2
  • Reuse the existing V2 metadata schema (e.g. DatasourceMetadataSchemaV2()) where applicable for consistency.

Acceptance criteria

  • nutanix_subnets_v2 accepts an optional metadata block (e.g. category_ids) and persists it on create/update.
  • nutanix_subnet_v2 and nutanix_subnets_v2 data sources expose a computed metadata block populated from the API.
  • Acceptance tests cover: creating a subnet with metadata, reading it back via resource and data source, and optionally updating metadata.

References

  • Subnet V2 API.
  • Existing metadata handling in other V2 resources (e.g. VPC, floating IP) in this provider.

Metadata

Metadata

Labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions