Skip to content

Make mounts importable - #16

Merged
paddycarver merged 4 commits into
masterfrom
paddy_import_mount
Aug 30, 2017
Merged

Make mounts importable#16
paddycarver merged 4 commits into
masterfrom
paddy_import_mount

Conversation

@paddycarver

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@catsby catsby left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread vault/resource_mount.go

d.Set("default_lease_ttl_seconds", mount.DefaultLeaseTTL)
d.Set("max_lease_ttl_seconds", mount.MaxLeaseTTL)
mount, ok := mounts[strings.Trim(path, "/")+"/"]

Copy link
Copy Markdown
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
Copy Markdown
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

@catsby catsby left a comment

Copy link
Copy Markdown
Contributor

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