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

Option to specify mount point in provider block #1

Open
arturtamborski opened this issue Sep 22, 2022 · 1 comment · May be fixed by #2
Open

Option to specify mount point in provider block #1

arturtamborski opened this issue Sep 22, 2022 · 1 comment · May be fixed by #2

Comments

@arturtamborski
Copy link

Hi! Thank you for forking this repo and adding the macOS support, it's really helpful!

Would you be interested to accept a patch implementing a way of specifying a mount point?

Here's an example of my idea:

terraform {
  required_providers {
    pass = {
      source = "mecodia/pass"
    }
  }
}
# [...]
+provider "pass" {
+  mount = "work-secrets"
+}

this, in turn, would allow the user to only specify the key in said mountpoint:

data "pass_password" "my_github_password" {
-  path = "work-secrets/github/password"
+  path = "github/password"
}

which in my opinion would come in handy when you use a lot of secrets:

  • allows you to shorten the repetitive path a bit over multiple resources/data sources
  • helps in avoiding a misconfiguration in situations where the same path is present in both root and custom mounts.

From technical perspective I was thinking on implementing it like so:

  • adding a variable to the passProvider state struct
  • checking if specified mount point is present at the provider initialization
  • prefixing every path with the passProvider.mount in resources and data sources

Let me know what do you think about it :) cheers

@toabi
Copy link
Member

toabi commented Nov 3, 2022

Sorry for the long wait.

I like the idea and removing all those same prefixes would be nice. I did that with some local variable in some projects though so path = ${local.pass_base}/github/password.

I would still accept this as a nice Pull Request :)

@arturtamborski arturtamborski linked a pull request Nov 14, 2022 that will close this issue
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 a pull request may close this issue.

2 participants