1. Packages
  2. Bitwarden Provider
  3. API Docs
  4. Attachment
bitwarden 0.13.6 published on Thursday, Apr 17, 2025 by maxlaverse

bitwarden.Attachment

Explore with Pulumi AI

bitwarden logo
bitwarden 0.13.6 published on Thursday, Apr 17, 2025 by maxlaverse

    Manages an item attachment.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as bitwarden from "@pulumi/bitwarden";
    
    const vpnCredentials = new bitwarden.ItemLogin("vpnCredentials", {username: "admin"});
    const vpnConfigFromContent = new bitwarden.Attachment("vpnConfigFromContent", {
        fileName: "vpn-config.txt",
        content: JSON.stringify({
            domain: "example.com",
            persistence: {
                enabled: true,
            },
        }),
        itemId: vpnCredentials.itemLoginId,
    });
    const vpnConfigFromFile = new bitwarden.Attachment("vpnConfigFromFile", {
        file: "vpn-config.txt",
        itemId: vpnCredentials.itemLoginId,
    });
    
    import pulumi
    import json
    import pulumi_bitwarden as bitwarden
    
    vpn_credentials = bitwarden.ItemLogin("vpnCredentials", username="admin")
    vpn_config_from_content = bitwarden.Attachment("vpnConfigFromContent",
        file_name="vpn-config.txt",
        content=json.dumps({
            "domain": "example.com",
            "persistence": {
                "enabled": True,
            },
        }),
        item_id=vpn_credentials.item_login_id)
    vpn_config_from_file = bitwarden.Attachment("vpnConfigFromFile",
        file="vpn-config.txt",
        item_id=vpn_credentials.item_login_id)
    
    package main
    
    import (
    	"encoding/json"
    
    	"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 {
    		vpnCredentials, err := bitwarden.NewItemLogin(ctx, "vpnCredentials", &bitwarden.ItemLoginArgs{
    			Username: pulumi.String("admin"),
    		})
    		if err != nil {
    			return err
    		}
    		tmpJSON0, err := json.Marshal(map[string]interface{}{
    			"domain": "example.com",
    			"persistence": map[string]interface{}{
    				"enabled": true,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		json0 := string(tmpJSON0)
    		_, err = bitwarden.NewAttachment(ctx, "vpnConfigFromContent", &bitwarden.AttachmentArgs{
    			FileName: pulumi.String("vpn-config.txt"),
    			Content:  pulumi.String(json0),
    			ItemId:   vpnCredentials.ItemLoginId,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = bitwarden.NewAttachment(ctx, "vpnConfigFromFile", &bitwarden.AttachmentArgs{
    			File:   pulumi.String("vpn-config.txt"),
    			ItemId: vpnCredentials.ItemLoginId,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Bitwarden = Pulumi.Bitwarden;
    
    return await Deployment.RunAsync(() => 
    {
        var vpnCredentials = new Bitwarden.ItemLogin("vpnCredentials", new()
        {
            Username = "admin",
        });
    
        var vpnConfigFromContent = new Bitwarden.Attachment("vpnConfigFromContent", new()
        {
            FileName = "vpn-config.txt",
            Content = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["domain"] = "example.com",
                ["persistence"] = new Dictionary<string, object?>
                {
                    ["enabled"] = true,
                },
            }),
            ItemId = vpnCredentials.ItemLoginId,
        });
    
        var vpnConfigFromFile = new Bitwarden.Attachment("vpnConfigFromFile", new()
        {
            File = "vpn-config.txt",
            ItemId = vpnCredentials.ItemLoginId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.bitwarden.ItemLogin;
    import com.pulumi.bitwarden.ItemLoginArgs;
    import com.pulumi.bitwarden.Attachment;
    import com.pulumi.bitwarden.AttachmentArgs;
    import static com.pulumi.codegen.internal.Serialization.*;
    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) {
            var vpnCredentials = new ItemLogin("vpnCredentials", ItemLoginArgs.builder()
                .username("admin")
                .build());
    
            var vpnConfigFromContent = new Attachment("vpnConfigFromContent", AttachmentArgs.builder()
                .fileName("vpn-config.txt")
                .content(serializeJson(
                    jsonObject(
                        jsonProperty("domain", "example.com"),
                        jsonProperty("persistence", jsonObject(
                            jsonProperty("enabled", true)
                        ))
                    )))
                .itemId(vpnCredentials.itemLoginId())
                .build());
    
            var vpnConfigFromFile = new Attachment("vpnConfigFromFile", AttachmentArgs.builder()
                .file("vpn-config.txt")
                .itemId(vpnCredentials.itemLoginId())
                .build());
    
        }
    }
    
    resources:
      vpnCredentials:
        type: bitwarden:ItemLogin
        properties:
          username: admin
      vpnConfigFromContent:
        type: bitwarden:Attachment
        properties:
          # NOTE: Only works when the experimental embedded client support is enabled
          fileName: vpn-config.txt
          content:
            fn::toJSON:
              domain: example.com
              persistence:
                enabled: true
          itemId: ${vpnCredentials.itemLoginId}
      vpnConfigFromFile:
        type: bitwarden:Attachment
        properties:
          file: vpn-config.txt
          itemId: ${vpnCredentials.itemLoginId}
    

    Create Attachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Attachment(name: string, args: AttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def Attachment(resource_name: str,
                   args: AttachmentArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def Attachment(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   item_id: Optional[str] = None,
                   content: Optional[str] = None,
                   file: Optional[str] = None,
                   file_name: Optional[str] = None)
    func NewAttachment(ctx *Context, name string, args AttachmentArgs, opts ...ResourceOption) (*Attachment, error)
    public Attachment(string name, AttachmentArgs args, CustomResourceOptions? opts = null)
    public Attachment(String name, AttachmentArgs args)
    public Attachment(String name, AttachmentArgs args, CustomResourceOptions options)
    
    type: bitwarden:Attachment
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AttachmentArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var attachmentResource = new Bitwarden.Attachment("attachmentResource", new()
    {
        ItemId = "string",
        Content = "string",
        File = "string",
        FileName = "string",
    });
    
    example, err := bitwarden.NewAttachment(ctx, "attachmentResource", &bitwarden.AttachmentArgs{
    	ItemId:   pulumi.String("string"),
    	Content:  pulumi.String("string"),
    	File:     pulumi.String("string"),
    	FileName: pulumi.String("string"),
    })
    
    var attachmentResource = new Attachment("attachmentResource", AttachmentArgs.builder()
        .itemId("string")
        .content("string")
        .file("string")
        .fileName("string")
        .build());
    
    attachment_resource = bitwarden.Attachment("attachmentResource",
        item_id="string",
        content="string",
        file="string",
        file_name="string")
    
    const attachmentResource = new bitwarden.Attachment("attachmentResource", {
        itemId: "string",
        content: "string",
        file: "string",
        fileName: "string",
    });
    
    type: bitwarden:Attachment
    properties:
        content: string
        file: string
        fileName: string
        itemId: string
    

    Attachment Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Attachment resource accepts the following input properties:

    ItemId string
    Identifier of the item the attachment belongs to
    Content string
    Path to the content of the attachment.
    File string
    Path to the content of the attachment.
    FileName string
    File name
    ItemId string
    Identifier of the item the attachment belongs to
    Content string
    Path to the content of the attachment.
    File string
    Path to the content of the attachment.
    FileName string
    File name
    itemId String
    Identifier of the item the attachment belongs to
    content String
    Path to the content of the attachment.
    file String
    Path to the content of the attachment.
    fileName String
    File name
    itemId string
    Identifier of the item the attachment belongs to
    content string
    Path to the content of the attachment.
    file string
    Path to the content of the attachment.
    fileName string
    File name
    item_id str
    Identifier of the item the attachment belongs to
    content str
    Path to the content of the attachment.
    file str
    Path to the content of the attachment.
    file_name str
    File name
    itemId String
    Identifier of the item the attachment belongs to
    content String
    Path to the content of the attachment.
    file String
    Path to the content of the attachment.
    fileName String
    File name

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Attachment resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Size string
    Size in bytes
    SizeName string
    Size as string
    Url string
    URL
    Id string
    The provider-assigned unique ID for this managed resource.
    Size string
    Size in bytes
    SizeName string
    Size as string
    Url string
    URL
    id String
    The provider-assigned unique ID for this managed resource.
    size String
    Size in bytes
    sizeName String
    Size as string
    url String
    URL
    id string
    The provider-assigned unique ID for this managed resource.
    size string
    Size in bytes
    sizeName string
    Size as string
    url string
    URL
    id str
    The provider-assigned unique ID for this managed resource.
    size str
    Size in bytes
    size_name str
    Size as string
    url str
    URL
    id String
    The provider-assigned unique ID for this managed resource.
    size String
    Size in bytes
    sizeName String
    Size as string
    url String
    URL

    Look up Existing Attachment Resource

    Get an existing Attachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: AttachmentState, opts?: CustomResourceOptions): Attachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            content: Optional[str] = None,
            file: Optional[str] = None,
            file_name: Optional[str] = None,
            item_id: Optional[str] = None,
            size: Optional[str] = None,
            size_name: Optional[str] = None,
            url: Optional[str] = None) -> Attachment
    func GetAttachment(ctx *Context, name string, id IDInput, state *AttachmentState, opts ...ResourceOption) (*Attachment, error)
    public static Attachment Get(string name, Input<string> id, AttachmentState? state, CustomResourceOptions? opts = null)
    public static Attachment get(String name, Output<String> id, AttachmentState state, CustomResourceOptions options)
    resources:  _:    type: bitwarden:Attachment    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Content string
    Path to the content of the attachment.
    File string
    Path to the content of the attachment.
    FileName string
    File name
    ItemId string
    Identifier of the item the attachment belongs to
    Size string
    Size in bytes
    SizeName string
    Size as string
    Url string
    URL
    Content string
    Path to the content of the attachment.
    File string
    Path to the content of the attachment.
    FileName string
    File name
    ItemId string
    Identifier of the item the attachment belongs to
    Size string
    Size in bytes
    SizeName string
    Size as string
    Url string
    URL
    content String
    Path to the content of the attachment.
    file String
    Path to the content of the attachment.
    fileName String
    File name
    itemId String
    Identifier of the item the attachment belongs to
    size String
    Size in bytes
    sizeName String
    Size as string
    url String
    URL
    content string
    Path to the content of the attachment.
    file string
    Path to the content of the attachment.
    fileName string
    File name
    itemId string
    Identifier of the item the attachment belongs to
    size string
    Size in bytes
    sizeName string
    Size as string
    url string
    URL
    content str
    Path to the content of the attachment.
    file str
    Path to the content of the attachment.
    file_name str
    File name
    item_id str
    Identifier of the item the attachment belongs to
    size str
    Size in bytes
    size_name str
    Size as string
    url str
    URL
    content String
    Path to the content of the attachment.
    file String
    Path to the content of the attachment.
    fileName String
    File name
    itemId String
    Identifier of the item the attachment belongs to
    size String
    Size in bytes
    sizeName String
    Size as string
    url String
    URL

    Import

    $ pulumi import bitwarden:index/attachment:Attachment example <item_id>/<attachment_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    bitwarden maxlaverse/terraform-provider-bitwarden
    License
    Notes
    This Pulumi package is based on the bitwarden Terraform Provider.
    bitwarden logo
    bitwarden 0.13.6 published on Thursday, Apr 17, 2025 by maxlaverse