Skip to content

Conversation

@toptobes
Copy link
Contributor

@toptobes toptobes commented Oct 16, 2025

STATUS: Currently all of the implementation code is written and in theory working, but is not tested as of yet (no actual access to PCU stuff yet). Also a lot of minor TODOs to come back to.

Adds support for the following:

  • pcu_group data source
  • pcu_groups data source
  • pcu_group_associations data source
  • resolve_datacenter function (warning: requires terraform v1.8+)
  • pcu_group resource
  • pcu_group_association resource

Had to comment out the implementations of a few other resources/data sources as the modified astra-go-client used in this branch has unintended breaking changes.


TODOs before merging

  • Inconsistent return for cloud provider value (observed AZURE vs Azure coming back from API?) -> should sanitize the case of return values?
  • Fix non-backwards-compatible changes in astra-go-client on related PR

…oking, but untested and quite a few TODOs to come back to)
@toptobes toptobes marked this pull request as draft October 16, 2025 06:20
@toptobes toptobes linked an issue Oct 16, 2025 that may be closed by this pull request
@bdunn313 bdunn313 requested a review from Copilot November 6, 2025 21:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive support for PCU (Provisioned Capacity Units) operations, enabling users to manage dedicated compute capacity for databases through Terraform. The implementation includes data sources for querying PCU groups and associations, resources for managing them, and a provider function to simplify datacenter ID resolution.

Key changes:

  • Adds PCU group management resources and data sources for provisioning and querying dedicated compute capacity
  • Introduces a resolve_datacenter function to simplify datacenter ID lookups from database resources
  • Updates test infrastructure to properly export environment variables for acceptance tests

Reviewed Changes

Copilot reviewed 32 out of 34 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/run_tests.sh Exports TF_ACC environment variable to enable acceptance tests
internal/provider/validators.go Adds Int32 validator for greater-than-or-equal-to comparisons
internal/provider/utils_pcu.go Implements core PCU service interfaces and API interaction logic
internal/provider/util_terraform.go Adds helper functions for Terraform attribute merging and HTTP response handling
internal/provider/util_misc.go Adds generic utility functions for nil handling and type conversions
internal/provider/types_pcus.go Defines PCU data models and schema attribute builders
internal/provider/resource_table.go Updates import order (cosmetic change)
internal/provider/resource_pcu_group_test.go Adds acceptance tests for PCU group lifecycle
internal/provider/resource_pcu_group_assocation.go Implements PCU group association resource with transfer support
internal/provider/resource_pcu_group.go Implements PCU group resource with park/unpark functionality
internal/provider/resource_database.go Updates comments from "All" to "FindById"
internal/provider/provider_framework_test.go Adds test helper for creating Astra client
internal/provider/provider_framework.go Registers new PCU data sources, resources, and functions
internal/provider/function_resolve_datacenter.go Implements datacenter ID resolution function
internal/provider/data_source_pcu_groups.go Implements data source for listing PCU groups
internal/provider/data_source_pcu_group_associations.go Implements data source for PCU group associations
internal/provider/data_source_pcu_group.go Implements data source for single PCU group lookup
go.mod Updates Go version and dependency versions
examples/ and docs/ files Adds documentation and examples for new PCU features

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bdunn313 bdunn313 marked this pull request as ready for review November 20, 2025 17:26
It's expensive both in time and money to test PCU APIs repeatedly and
reliably, so it makes sense to limit this to a smoke test.
@bdunn313 bdunn313 merged commit 2c5bf24 into main Nov 21, 2025
4 checks passed
@bdunn313 bdunn313 deleted the PCU-support branch November 21, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for PCU operations

3 participants