bitwarden 0.13.6 published on Thursday, Apr 17, 2025 by maxlaverse
bitwarden.getAttachment
Explore with Pulumi AI
bitwarden 0.13.6 published on Thursday, Apr 17, 2025 by maxlaverse
Use this data source to get the content on an existing item’s attachment.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as bitwarden from "@pulumi/bitwarden";
import * as kubernetes from "@pulumi/kubernetes";
const ssh = bitwarden.getItemLogin({
search: "VPN/Credentials",
});
const sshPrivateKey = ssh.then(ssh => bitwarden.getAttachment({
id: "4d6a41364d6a4dea8ddb1a",
itemId: ssh.id,
}));
// Example of usage of the data source:
const sshKeys = new kubernetes.index.Kubernetes_secret("sshKeys", {
metadata: [{
name: "ssh-keys",
}],
data: {
"private.key": data.bitwarden_attachment.vpn_ssh_private_key.content,
},
});
import pulumi
import pulumi_bitwarden as bitwarden
import pulumi_kubernetes as kubernetes
ssh = bitwarden.get_item_login(search="VPN/Credentials")
ssh_private_key = bitwarden.get_attachment(id="4d6a41364d6a4dea8ddb1a",
item_id=ssh.id)
# Example of usage of the data source:
ssh_keys = kubernetes.index.Kubernetes_secret("sshKeys",
metadata=[{
name: ssh-keys,
}],
data={
private.key: data.bitwarden_attachment.vpn_ssh_private_key.content,
})
package main
import (
"github.com/pulumi/pulumi-kubernetes/sdk/go/kubernetes"
"github.com/pulumi/pulumi-terraform-provider/sdks/go/bitwarden/bitwarden"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
ssh, err := bitwarden.LookupItemLogin(ctx, &bitwarden.LookupItemLoginArgs{
Search: pulumi.StringRef("VPN/Credentials"),
}, nil)
if err != nil {
return err
}
_, err = bitwarden.LookupAttachment(ctx, &bitwarden.LookupAttachmentArgs{
Id: "4d6a41364d6a4dea8ddb1a",
ItemId: ssh.Id,
}, nil)
if err != nil {
return err
}
// Example of usage of the data source:
_, err = kubernetes.NewKubernetes_secret(ctx, "sshKeys", &kubernetes.Kubernetes_secretArgs{
Metadata: []map[string]interface{}{
map[string]interface{}{
"name": "ssh-keys",
},
},
Data: map[string]interface{}{
"private.key": data.Bitwarden_attachment.Vpn_ssh_private_key.Content,
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Bitwarden = Pulumi.Bitwarden;
using Kubernetes = Pulumi.Kubernetes;
return await Deployment.RunAsync(() =>
{
var ssh = Bitwarden.GetItemLogin.Invoke(new()
{
Search = "VPN/Credentials",
});
var sshPrivateKey = Bitwarden.GetAttachment.Invoke(new()
{
Id = "4d6a41364d6a4dea8ddb1a",
ItemId = ssh.Apply(getItemLoginResult => getItemLoginResult.Id),
});
// Example of usage of the data source:
var sshKeys = new Kubernetes.Index.Kubernetes_secret("sshKeys", new()
{
Metadata = new[]
{
{
{ "name", "ssh-keys" },
},
},
Data =
{
{ "private.key", data.Bitwarden_attachment.Vpn_ssh_private_key.Content },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.bitwarden.BitwardenFunctions;
import com.pulumi.bitwarden.inputs.GetItemLoginArgs;
import com.pulumi.bitwarden.inputs.GetAttachmentArgs;
import com.pulumi.kubernetes.kubernetes_secret;
import com.pulumi.kubernetes.Kubernetes_secretArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var ssh = BitwardenFunctions.getItemLogin(GetItemLoginArgs.builder()
.search("VPN/Credentials")
.build());
final var sshPrivateKey = BitwardenFunctions.getAttachment(GetAttachmentArgs.builder()
.id("4d6a41364d6a4dea8ddb1a")
.itemId(ssh.applyValue(getItemLoginResult -> getItemLoginResult.id()))
.build());
// Example of usage of the data source:
var sshKeys = new Kubernetes_secret("sshKeys", Kubernetes_secretArgs.builder()
.metadata(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.data(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.build());
}
}
resources:
# Example of usage of the data source:
sshKeys:
type: kubernetes:kubernetes_secret
properties:
metadata:
- name: ssh-keys
data:
private.key: ${data.bitwarden_attachment.vpn_ssh_private_key.content}
variables:
ssh:
fn::invoke:
function: bitwarden:getItemLogin
arguments:
search: VPN/Credentials
sshPrivateKey:
fn::invoke:
function: bitwarden:getAttachment
arguments:
id: 4d6a41364d6a4dea8ddb1a
itemId: ${ssh.id}
Using getAttachment
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getAttachment(args: GetAttachmentArgs, opts?: InvokeOptions): Promise<GetAttachmentResult>
function getAttachmentOutput(args: GetAttachmentOutputArgs, opts?: InvokeOptions): Output<GetAttachmentResult>
def get_attachment(id: Optional[str] = None,
item_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAttachmentResult
def get_attachment_output(id: Optional[pulumi.Input[str]] = None,
item_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAttachmentResult]
func LookupAttachment(ctx *Context, args *LookupAttachmentArgs, opts ...InvokeOption) (*LookupAttachmentResult, error)
func LookupAttachmentOutput(ctx *Context, args *LookupAttachmentOutputArgs, opts ...InvokeOption) LookupAttachmentResultOutput
> Note: This function is named LookupAttachment
in the Go SDK.
public static class GetAttachment
{
public static Task<GetAttachmentResult> InvokeAsync(GetAttachmentArgs args, InvokeOptions? opts = null)
public static Output<GetAttachmentResult> Invoke(GetAttachmentInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetAttachmentResult> getAttachment(GetAttachmentArgs args, InvokeOptions options)
public static Output<GetAttachmentResult> getAttachment(GetAttachmentArgs args, InvokeOptions options)
fn::invoke:
function: bitwarden:index/getAttachment:getAttachment
arguments:
# arguments dictionary
The following arguments are supported:
getAttachment Result
The following output properties are available:
Package Details
- Repository
- bitwarden maxlaverse/terraform-provider-bitwarden
- License
- Notes
- This Pulumi package is based on the
bitwarden
Terraform Provider.
bitwarden 0.13.6 published on Thursday, Apr 17, 2025 by maxlaverse