-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add Service Account support #99
Conversation
Does this mean that when updating an item, it will get a new UUID and new urls? |
@franklouwers yes, unfortunately. It might be tweakable to use the actual |
@tim-oster does that mean the agent running this needs the |
@tim-oster Great contribution! Your work will help us a lot to release this feature even faster! 🚀 |
@volodymyrZotov thanks for the review! @gabrielrinaldi yes, unfortunately using the CLI seems to be the only option at the moment. I am not too familiar with tf cloud, do you have access to a local file system? In that case, it might be worth investigating if we can bundle the cli binary together with the provider binary. Though this would drastically increase the provider's binary size. |
@gabrielrinaldi Only Install Standalone Binaries article might be helpful to understand how you can add additional binaries. And this one Install 1Password CLI might help to install. See Hope those will help you to figure out how to do that 😃 Let me know how it's going for you, please. |
@volodymyrZotov amazing, thanks for pointing it out! Can't wait for this to be merged. |
Hi folks! And especially @tim-oster 👋 Just want to put an update about the item edit. Implementing that with the current cli version brings some difficulties, so we decided to add a piped input feature to the cli I'm on that feature right now. I'll keep you posted about the progress. The initial aim is to have a new cli release with this feature later next week, but will see how it goes. 🚀 |
@volodymyrZotov amazing, thanks for having a look at this so quickly! I'll update the PR as soon the CLI is released. Looking forward to getting this merged 💪 |
Hi @tim-oster. Just an update on that. We're still working on the item edit piped input feature. I'll let you know as soon as we have a new cli release with it and happy to help bring your PR to the finish line 🙂 |
I just started a complex implementation an realize I might just be stuck at this stage due to this bug. Any ETA for the release ? |
In the meantime here is a hack using module: variable "item_ref" {}
locals {
temp_dir = "${path.root}/op_tmp"
}
resource "local_file" "output" {
filename = "${local.temp_dir}/${timestamp()}.txt"
content = ""
}
resource "null_resource" "op_read" {
triggers = {
once = timestamp()
}
provisioner "local-exec" {
command = "op read ${var.item_ref} > ${local_file.output.filename}"
}
}
data "local_file" "output" {
depends_on = [null_resource.op_read]
filename = local_file.output.filename
}
resource "null_resource" "deleteLocalFile" {
depends_on = [null_resource.op_read, data.local_file.output]
triggers = {
once = timestamp()
}
provisioner "local-exec" {
command = "rm -rf ${local.temp_dir}"
}
}
output "item_value" {
value = data.local_file.output.content
} usage example: module "op" {
source = "../modules/op"
item_ref = "op://myvault/fooprovider/api-token"
}
output "result" {
value = module.op.item_value
} |
Thanks for the quick answer, I am using terraform-cloud though; probably won't do the trick :/ |
Having to fall back to calling |
Sure, totally agree guys, |
@tim-oster Hi. Some updates about |
@tim-oster Hi! 👋 We plan to release a new CLI version that includes the feature to edit items using templates later this week. |
@tim-oster @volodymyrZotov - Looks like the new CLI version was released 🙂 https://app-updates.agilebits.com/product_history/CLI2#v2230001 Looking forward to using this functionality! 🙂 |
@volodymyrZotov @dbrennand the new CLI update is awesome! Works as expected! |
Awesome 🙌🏻 - hopefully @volodymyrZotov can review soon and get this merged! 😃 Thanks for your hard work! |
@tim-oster Hi. I pushed some commits to slightly change the error messages and address a couple of issues (see commits above). While testing I found at least one issue that we need to address before moving forward. It can't create passwords when using CLI and throws an error:
I'll continue looking into that tomorrow and continue testing to see if I can find any other issues. |
Functional review: ✅Performed intensive testing on that. Fixed several issues including #107. Code review: ✅The code looks good and straightforward. Additional note: 💬Users may encounter the following error
|
…tion As op_cli_path is 'op' by default.
Added myself as a co-author to sign all the commits. |
So is this able to be used on terraform cloud? |
This PR adds support for using an 1Password Service Account token as opposed to using a Connect Server setup (#79).
The implementation is best effort but most likely not ideal. It is a wrapper around the
op
CLI to be able to make use of the service account token. As of today, there seems to be no other option to interface with 1password other than the cli or a connect server.The biggest issue in this implementation is, that updating an item will first delete it and then createa new one. The main reason for this is, that
op
does not support updating items using json. Ideally, we would useFroceNew
for this in the provider but since it needs to be compatible with the Connect Server mode, this is not possible.