-
Notifications
You must be signed in to change notification settings - Fork 549
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
Update entity alias creation to use entity lookup api #1517
Conversation
mountAccessor := data["mount_accessor"].(string) | ||
aliases, err := entity.FindAliases(client, &entity.FindAliasParams{ |
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.
The only other use of this function is vault/resource_identity_entity_alias_test.go#L191. I'm not sure if it is better to just replace that reference with a more specific helper function or just leave it as is.
The current implementation of entity.FindAliases
is only really dangerous when running against a server with a large number of entities, which won't be the case when running the tests.
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.
Good point, we will take a closer look after your PR is merged!
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.
LGTM!
Thank you for your contribution to HashiCorp!
@@ -3,6 +3,7 @@ package vault | |||
import ( | |||
"context" | |||
"fmt" | |||
"github.com/hashicorp/vault/api" |
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: we prefer the that the built-in imports are always grouped together, we can update this after merge however.
When creating an entity alias, the Vault Terraform Provider is currently listing all existing entities, making individual GET requests to those entities, and then inspecting the responses to make sure you aren’t making a duplicate alias.
Vault exposes a entity lookup API that we can leverage to accomplish this same duplication check in a single API call.
Community Note
Release note for CHANGELOG:
Output from acceptance testing: