-
Notifications
You must be signed in to change notification settings - Fork 39
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
Usage examples for data onepassword_item_common to get fields from the item #23
Comments
Hi @Merlz |
Hi @anasinnyk
Database category might be worth having its own Data and Resource items with attribute outputs? The |
Any update on this for examples? I have a login item with some sections and fields. I'd like to be able to grab the string value from a field. This is the value of the login item:
How do I get the string value of |
I was able to get the value I wanted with this but it seems way overly complicated for the task:
That outputs the value I must be missing something. |
I am using the index list function to find relevant items from the # assumign the following providers are setup:
# - onepassword
# - vault
data "onepassword_item_common" "github_app" {
name = "GitHub App Secrets"
}
locals {
relevant_section = data.onepassword_item_common.kodiak.section[index(data.onepassword_item_common.github_app.section.*.name, "")]
github_app_id_field = local.relevant_section.field[index(local.relevant_section.field.*.name, "App ID")]
secret_key_field = local.relevant_section.field[index(local.relevant_section.field.*.name, "Webhook Secret")]
github_app_name_field = local.relevant_section.field[index(local.relevant_section.field.*.name, "GitHub App name")]
}
data "onepassword_item_document" "github_app_pem" {
name = "GitHub App Secrets - XYZ.private-key.pem"
}
resource "vault_generic_secret" "github_app" {
path = "${vault_mount.generic.path}/github_app"
data_json = jsonencode({
github_app_id: local.github_app_id_field.string,
secret_key: local.github_app_id_field.concealed,
github_app_name: local.github_app_id_field.string,
github_private_key: data.onepassword_item_document.github_app_pem.content,
})
} In effect this is pretty much the same as the solution @chrisbalmer suggested, but for me the use of dedicated local vars in conjunciton with the |
I've been testing this out to retrieve the fields from
data "onepassword_item_common"
so that I could then take those fields and use in a k8s secret resource. From what I gather, it can only return the ID (UUID) of the item in the vault, not the entire record with all the fields within that item, is that correct?The text was updated successfully, but these errors were encountered: