terraform-provider-onepassword
terraform-provider-onepassword copied to clipboard
Add support for document data source
I have have only tested this with unittests and cli, as I do not have a connect.
- Supports multiple files
- Supports text documents and binary documents (provided one uses the
content_base64
version)
Roundtrip test:
data "onepassword_item" "foo" {
vault = var.demo_vault
uuid = "..."
}
resource "local_file" "truststore" {
filename = "truststore.jks"
content_base64 = data.onepassword_item.foo.file.2.content_base64
}
(where 2 is the third file for that item, added via the UI)
I had to use the op read
approach rather than op document get
(unless I am missing an undocumented feature) to be able to handle multiple files.
I have not tried to implement a resource, since as far as I understood connect cannot support it and I don't see a way to distinguish between the two backends.
~~The document
category is available also for resource, that is slightly incorrect.~~
This looks related to #51. I have a connect API setup for my Kubernetes clusters, I might be able to test this if I get some time to build and deploy your branch.
Ran go generate
to get updated docs, but it seems that terraform-plugin-docs
fails to include descriptions of nested fields 😢 EDIT: turns out that the descriptions are already missing in terraform providers schema -json
@volodymyrZotov comments adressed
Speculating with myself: Actually, the fact that descriptions are missing from the schema might be a slight issue if things like sensitive: true
is also missing
It seems that the cheese has been moved (due to #167). I'll see if I can figure out what changes are needed due to the change of tf framework.
Also, it seems that #164 is somewhat related.
Ok, I have something that seems to work locally against main. Will create a superseding PR when I have cleaned up it a little bit more.
Superceded by #171
@volodymyrZotov would you review that one instead, please?
@sdahlbac Hi, was about to write to you that there was a migration and you would need to adjust your PR because of that, but I see you figured it out already 👍 Will take another look there.