Skip to content
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

Merged
merged 4 commits into from
Aug 30, 2017
Merged

Make mounts importable #16

merged 4 commits into from
Aug 30, 2017

Conversation

paddycarver
Copy link
Contributor

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.

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.
@paddycarver
Copy link
Contributor Author

Test failure is vendoring acctest. Should be fixed by #12.

Copy link
Contributor

@catsby catsby left a 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

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, "/")+"/"]
Copy link
Contributor

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 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with comment :D

Copy link
Contributor

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@paddycarver paddycarver merged commit d907295 into master Aug 30, 2017
@tyrannosaurus-becks tyrannosaurus-becks deleted the paddy_import_mount branch February 16, 2019 00:20
dandandy pushed a commit to dandandy/terraform-provider-vault that referenced this pull request Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants