Make mounts importable - #16
Merged
Merged
Conversation
Read all properties when reading a mount. This means we need to list all mounts and select just the one we need, instead of just requesting the config for the one we need. Which isn't the end of the world. This will help when we're importing.
This involved adding the schema.ImportStatePassthrough, and then just updating tests. Added a test for the import, but also made the basic config a function that we can inject a name into, so tests are more resilient to dangling resources.
Contributor
Author
|
Test failure is vendoring acctest. Should be fixed by #12. |
catsby
reviewed
Aug 28, 2017
catsby
left a comment
Contributor
There was a problem hiding this comment.
Request for comment there. Also, is it appropriate to call READ at the end of CREATE here? If so we should add that
|
|
||
| d.Set("default_lease_ttl_seconds", mount.DefaultLeaseTTL) | ||
| d.Set("max_lease_ttl_seconds", mount.MaxLeaseTTL) | ||
| mount, ok := mounts[strings.Trim(path, "/")+"/"] |
Contributor
There was a problem hiding this comment.
So, sometimes path has a trailing /, but sometimes it doesn't? So here we ensure it has a single /? Is that what's happening? Please add some comments here for future readers 😄
Contributor
Author
There was a problem hiding this comment.
Updated with comment :D
dandandy
pushed a commit
to dandandy/terraform-provider-vault
that referenced
this pull request
Jun 17, 2021
…_mount Make mounts importable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update mount's read function to set all the data in state, instead of just what's available in the mount config.
Update the basic test to let us inject the path in, for more resilience to dangling resources.
Add the import logic and a test to ensure that it works as expected.