-
Notifications
You must be signed in to change notification settings - Fork 548
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
Make mounts importable #16
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.
Test failure is vendoring acctest. Should be fixed by #12. |
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.
Request for comment there. Also, is it appropriate to call READ
at the end of CREATE
here? If so we should add that
vault/resource_mount.go
Outdated
if err != nil { | ||
return fmt.Errorf("error reading from Vault: %s", err) | ||
} | ||
|
||
d.Set("default_lease_ttl_seconds", mount.DefaultLeaseTTL) | ||
d.Set("max_lease_ttl_seconds", mount.MaxLeaseTTL) | ||
mount, ok := mounts[strings.Trim(path, "/")+"/"] |
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.
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 😄
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.
Updated with comment :D
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.
👍
…_mount Make mounts importable
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.