-
Notifications
You must be signed in to change notification settings - Fork 545
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
Change vault_namespace ID to path #570
Change vault_namespace ID to path #570
Conversation
After:
|
Before:
|
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.
@petems - I had earlier marked this as approved, but I've been thinking about it more and also discussed a change in an ID in a subsequent PR. I realized that actually, changing the ID isn't backwards compatible, and I was wondering if we could add a migration path for the ID instead?
@tyrannosaurus-becks Happy to do so, but I'll need a hand helping with that. Are there examples of doing this in TF providers? Have you got time for a quick pairing session on it as well? 😄 |
@petems actually, I have a sample! We went through the same discussion on this PR, here's a direct link to the convo: #581 (comment). You should be able to check out the subsequent commits to see how it was implemented. |
d0d1183
to
a3ef21b
Compare
@tyrannosaurus-becks Perfect! I'm not sure how to add a test for this new scenario... is there a way to create a special resource to run tests on in the old state? |
I can see it working in the logs with a manual test of manually editing the statefile:
|
* The ID isn’t super useful, it’s only used by Vault internally * We should use the path as it allows imports of existing namespaces * Move the namespace ID to its own computed attribute `namespace_id` * Add logic detecting if the ID isnt the same as the path, then upgrade
a3ef21b
to
cd186e1
Compare
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 looks awesome. Thank you!
Change vault_namespace ID to path
The `id` of the namespace resource was changed to be the path in hashicorp#570, and the ID of the namespace is now in the `namespace_id` attribute, but the documentation was not updated.
The `id` of the namespace resource was changed to be the full path in hashicorp#570, and the ID of the namespace is now in the `namespace_id` attribute, but the documentation was not updated.
* Fix `namespace_id` attribute name in the `vault_namespace` resource docs The `id` of the namespace resource was changed to be the full path in #570, and the ID of the namespace is now in the `namespace_id` attribute, but the documentation was not updated. * Document that `path_fq` is relative to the provider's namespace * Fix and update the import example * Refactor the nested namespace example Drop extraneous local variable, and iterate over previous resources. * Add back the `id` attribute, and rephrase the `namespace_id` description
namespace_id