Skip to content

Add inventory_reporting_config to hcp_vault_cluster resource#1468

Open
Nexus357ZA wants to merge 7 commits intohashicorp:mainfrom
Nexus357ZA:feature/vault-inventory-reporting
Open

Add inventory_reporting_config to hcp_vault_cluster resource#1468
Nexus357ZA wants to merge 7 commits intohashicorp:mainfrom
Nexus357ZA:feature/vault-inventory-reporting

Conversation

@Nexus357ZA
Copy link
Copy Markdown

Description

This PR adds support for the HCP Vault Dedicated Inventory Reporting feature (currently in beta) to the hcp_vault_cluster resource. This allows users to enable/disable inventory reporting for secrets and certificates visibility through Terraform.

Related Documentation

Changes

Implementation

  • Added inventory_reporting_config block to hcp_vault_cluster resource schema
  • Implemented getter and flattener helper functions following existing patterns (metrics_config, audit_log_config)
  • Updated Create, Read, and Update operations to handle inventory reporting configuration
  • Modified UpdateVaultClusterConfig() in internal/clients/vault_cluster.go to support the new parameter
  • Utilized existing SDK models (HashicorpCloudVault20201125InputReportingConfig and HashicorpCloudVault20201125ReportingConfig)

Documentation

  • Added example usage in examples/resources/hcp_vault_cluster/resource.tf
  • Updated resource documentation template
  • Generated documentation using go generate
  • Added changelog entry

Schema

inventory_reporting_config {
  enabled = true
}

The enabled attribute defaults to false and controls whether Vault reports secret and certificate inventory data to HCP.

Testing

Code compiles successfully. Manual testing would require:

  • An HCP organization with access to Vault Dedicated beta features
  • Testing create with reporting enabled/disabled
  • Testing update to enable/disable reporting
  • Verifying state is correctly read and stored

Notes

  • This feature is currently in beta
  • The implementation follows existing patterns in the codebase for similar configuration blocks
  • Disabling reporting results in permanent data loss from HCP (documented in schema description)
  • The changelog file is named placeholder.txt and will be renamed to match the PR number once assigned

Checklist

  • Uses Plugin Framework patterns where applicable (SDKv2 resource)
  • Includes field descriptions in schema
  • Includes example usage
  • Generated documentation
  • Added changelog entry
  • Follows existing code conventions
  • Code formatted with go fmt
  • Acceptance tests (could be added if beta access available for testing)

This commit adds support for enabling and managing HCP Vault Dedicated
inventory reporting through the hcp_vault_cluster resource.

Changes:
- Added inventory_reporting_config schema block with enabled boolean field
- Implemented getInventoryReportingConfig() helper to extract config from state
- Implemented flattenInventoryReportingConfig() helper to populate state from API
- Updated UpdateVaultClusterConfig() to accept and handle reporting config
- Added reporting config to create, update, and read operations
- Updated HasChanges checks to include inventory_reporting_config

The feature allows users to:
- Enable inventory reporting on new clusters
- Enable/disable reporting on existing clusters
- Track reporting enrollment status in Terraform state

API support confirmed in HCP SDK v0.166.0:
- HashicorpCloudVault20201125InputReportingConfig (input)
- HashicorpCloudVault20201125ReportingConfig (output)

Related: Feature is currently in beta per HCP documentation
Documentation: https://developer.hashicorp.com/hcp/docs/vault/reporting
- Added changelog entry for the new feature
- Updated example to demonstrate inventory_reporting_config usage
- Regenerated documentation using go generate
- Docs now include inventory_reporting_config block description

This completes the contributing requirements for the feature.
@Nexus357ZA Nexus357ZA requested review from a team as code owners April 4, 2026 06:43
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

This PR is more than 2 weeks old. Please remove the stale label, update, or comment if this PR is still valid and relevant, otherwise it will be closed in 7 days.

@github-actions github-actions Bot added the stale label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant