-
Notifications
You must be signed in to change notification settings - Fork 173
Add HYOK data sources for HYOKCustomerKeyVersion and HYOKEncryptedDataKey #1842
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
base: main
Are you sure you want to change the base?
Add HYOK data sources for HYOKCustomerKeyVersion and HYOKEncryptedDataKey #1842
Conversation
…ersion, with some baseline tests that pass for me locally but need to be genericised
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested the data sources and they're working for me! Just a few nits and something I gotta do on the go-tfe end
// Set the computed attributes from the API response | ||
data.EncryptedDEK = types.StringValue(keyVersion.EncryptedDEK) | ||
data.CustomerKeyName = types.StringValue(keyVersion.CustomerKeyName) | ||
data.CreatedAt = types.StringValue(keyVersion.CreatedAt.Format(time.RFC3339)) // TODO DOM: Check this format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this can probably be removed!
|
||
```hcl | ||
data "tfe_hyok_customer_key_version" "tfe_hyok_customer_key_version1" { | ||
id = "keyv-<your-id>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non blocker: but it seems like some other id examples do not include <>. (eg. website/docs/d/team_project_access.html.markdown
)
So maybe something like
id = "keyv-<your-id>" | |
id = "my-key-version-id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helen, that's because the customer key version follows the pattern "keyv-####" where # is some id.
--- | ||
layout: "tfe" | ||
page_title: "Terraform Enterprise: tfe_agent_pool" | ||
description: |- | ||
Get information on an agent pool. | ||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the section at website/docs/d/hyok_encrypted_data_key.markdown
should probably be changed from agent pool stuff
|
||
// Make API call to fetch the HYOK customer key version | ||
keyVersion, err := d.config.Client.HYOKEncryptedDataKeys.Read(ctx, data.ID.ValueString()) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have that same condition Helen's PR for "Resource not found" if-statement?
performed a
|
also, I ran the same go test cases on my end with my HYOK_CUSTOMER_KEY_VERSION_ID and HYOK_ENCRYPTED_DATA_KEY_ID, worked as expected, here is the result:
|
Description
HYOKCustomerKeyVersion
HYOKEncryptedDataKey
TODO: Update the website docs for new datasources
Remember to:
Testing plan
Example Output of a Terraform Run:
External links
Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.
JIRA
Output from acceptance tests
Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.
If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.
Rollback Plan
Changes to Security Controls