Skip to content

Conversation

helenjw
Copy link

@helenjw helenjw commented Aug 27, 2025

Description

Add support for HYOK customer key versions and HYOK encrypted data keys.

Supported operations for HYOKCustomerKeyVersions:

  • List
  • Read
  • Revoke
  • Delete

Supported operations for HYOKEncryptedDataKey:

  • Read

External links

Output from tests

envchain local-go-tfe go test -run TestHYOKEncryptedDataKeyRead -v           16:46:44   29ms
=== RUN   TestHYOKEncryptedDataKeyRead
=== RUN   TestHYOKEncryptedDataKeyRead/read_an_existing_encrypted_data_key
--- PASS: TestHYOKEncryptedDataKeyRead (0.42s)
    --- PASS: TestHYOKEncryptedDataKeyRead/read_an_existing_encrypted_data_key (0.17s)
PASS
ok  	github.com/hashicorp/go-tfe	0.983s
envchain local-go-tfe go test -run TestHYOKCustomerKeyVersions -v          16:46:55   3.019s
=== RUN   TestHYOKCustomerKeyVersionsList
=== RUN   TestHYOKCustomerKeyVersionsList/with_no_list_options
--- PASS: TestHYOKCustomerKeyVersionsList (7.76s)
    --- PASS: TestHYOKCustomerKeyVersionsList/with_no_list_options (0.10s)
=== RUN   TestHYOKCustomerKeyVersionsRead
=== RUN   TestHYOKCustomerKeyVersionsRead/read_an_existing_key_version
--- PASS: TestHYOKCustomerKeyVersionsRead (0.34s)
    --- PASS: TestHYOKCustomerKeyVersionsRead/read_an_existing_key_version (0.12s)
PASS
ok  	github.com/hashicorp/go-tfe	8.630s

Rollback Plan

Changes to Security Controls

Copy link

hashicorp-cla-app bot commented Aug 27, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

hashicorp-cla-app bot commented Aug 27, 2025

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes


1 out of 2 committers have signed the CLA.

  • iuri-slywitch-hashicorp
  • helenjw

Have you signed the CLA already but the status is still pending? Recheck it.

@helenjw helenjw changed the base branch from main to feature/hyok August 27, 2025 19:30
@helenjw helenjw changed the title Add Support for Customer Key Version and Encrypted Data Keys Add support for Customer Key Version and Encrypted Data Keys Aug 27, 2025
@helenjw helenjw added the no-changelog-needed check changelog entry github workflow label Aug 27, 2025
Comment on lines +11 to +13
// AWSOIDCConfigurations describes all the AWS OIDC configuration related methods that the HCP Terraform API supports.
// HCP Terraform API docs:
// https://developer.hashicorp.com/terraform/cloud-docs/api-docs/hold-your-own-key/oidc-configurations/aws
Copy link
Author

Choose a reason for hiding this comment

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

Realized these were missing from the PR for OIDC and HYOK configs 😢

@helenjw helenjw requested a review from a team August 27, 2025 20:50
@helenjw helenjw marked this pull request as ready for review August 27, 2025 20:50
@helenjw helenjw requested a review from a team as a code owner August 27, 2025 20:50
// Read a HYOK encrypted data key by its ID.
func (h hyokEncryptedDataKeys) Read(ctx context.Context, hyokEncryptedDataKeyID string) (*HYOKEncryptedDataKey, error) {
if !validStringID(&hyokEncryptedDataKeyID) {
return nil, ErrInvalidHYOK

Choose a reason for hiding this comment

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

should we change ErrInvalidHYOK to something like ErrInvalidHYOKEncryptedDataKeyID?

Copy link
Author

Choose a reason for hiding this comment

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

This was also addressed in 519cd19

Choose a reason for hiding this comment

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

I wonder if we should have test cases for Revoke and Delete.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's tough, because we cant create the key version in tests. So we would need the user to manually input the key version ID which they want to revoke, and the test could only ever run once without changing the ID....that could work, but IMHO it probably isnt worth it

Copy link
Contributor

Choose a reason for hiding this comment

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

That's tough, because we cant create the key version in tests. So we would need the user to manually input the key version ID which they want to revoke, and the test could only ever run once without changing the ID....that could work, but IMHO it probably isnt worth it

@helenjw helenjw requested a review from JarrettSpiker August 28, 2025 13:59
Copy link

@iuri-slywitch-hashicorp iuri-slywitch-hashicorp left a comment

Choose a reason for hiding this comment

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

LGTM

@helenjw helenjw mentioned this pull request Aug 28, 2025
@helenjw helenjw merged commit b60638c into feature/hyok Aug 28, 2025
8 checks passed
@helenjw helenjw deleted the helenjw/TF-27660/hyok-customer-key-versions branch August 28, 2025 19:34
Copy link

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

helenjw added a commit that referenced this pull request Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog-needed check changelog entry github workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants