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

bitwarden.getSecret

Explore with Pulumi AI

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

Use this data source to get information on an existing secret.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as bitwarden from "@pulumi/bitwarden";
import * as kubernetes from "@pulumi/kubernetes";

const example = bitwarden.getSecret({
    id: "37a66d6a-96c1-4f04-9a3c-b1fc0135669e",
});
const vpnCredentials = new kubernetes.index.Kubernetes_secret("vpnCredentials", {
    metadata: [{
        name: "vpn-key",
    }],
    data: {
        PASSWORD: data.bitwarden_secret.value,
    },
});
Copy
import pulumi
import pulumi_bitwarden as bitwarden
import pulumi_kubernetes as kubernetes

example = bitwarden.get_secret(id="37a66d6a-96c1-4f04-9a3c-b1fc0135669e")
vpn_credentials = kubernetes.index.Kubernetes_secret("vpnCredentials",
    metadata=[{
        name: vpn-key,
    }],
    data={
        PASSWORD: data.bitwarden_secret.value,
    })
Copy
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 {
		_, err := bitwarden.LookupSecret(ctx, &bitwarden.LookupSecretArgs{
			Id: pulumi.StringRef("37a66d6a-96c1-4f04-9a3c-b1fc0135669e"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = kubernetes.NewKubernetes_secret(ctx, "vpnCredentials", &kubernetes.Kubernetes_secretArgs{
			Metadata: []map[string]interface{}{
				map[string]interface{}{
					"name": "vpn-key",
				},
			},
			Data: map[string]interface{}{
				"PASSWORD": data.Bitwarden_secret.Value,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Bitwarden = Pulumi.Bitwarden;
using Kubernetes = Pulumi.Kubernetes;

return await Deployment.RunAsync(() => 
{
    var example = Bitwarden.GetSecret.Invoke(new()
    {
        Id = "37a66d6a-96c1-4f04-9a3c-b1fc0135669e",
    });

    var vpnCredentials = new Kubernetes.Index.Kubernetes_secret("vpnCredentials", new()
    {
        Metadata = new[]
        {
            
            {
                { "name", "vpn-key" },
            },
        },
        Data = 
        {
            { "PASSWORD", data.Bitwarden_secret.Value },
        },
    });

});
Copy
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.GetSecretArgs;
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 example = BitwardenFunctions.getSecret(GetSecretArgs.builder()
            .id("37a66d6a-96c1-4f04-9a3c-b1fc0135669e")
            .build());

        var vpnCredentials = new Kubernetes_secret("vpnCredentials", 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());

    }
}
Copy
resources:
  vpnCredentials:
    type: kubernetes:kubernetes_secret
    properties:
      metadata:
        - name: vpn-key
      data:
        PASSWORD: ${data.bitwarden_secret.value}
variables:
  example:
    fn::invoke:
      function: bitwarden:getSecret
      arguments:
        id: 37a66d6a-96c1-4f04-9a3c-b1fc0135669e
Copy

Using getSecret

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 getSecret(args: GetSecretArgs, opts?: InvokeOptions): Promise<GetSecretResult>
function getSecretOutput(args: GetSecretOutputArgs, opts?: InvokeOptions): Output<GetSecretResult>
Copy
def get_secret(id: Optional[str] = None,
               key: Optional[str] = None,
               organization_id: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetSecretResult
def get_secret_output(id: Optional[pulumi.Input[str]] = None,
               key: Optional[pulumi.Input[str]] = None,
               organization_id: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetSecretResult]
Copy
func LookupSecret(ctx *Context, args *LookupSecretArgs, opts ...InvokeOption) (*LookupSecretResult, error)
func LookupSecretOutput(ctx *Context, args *LookupSecretOutputArgs, opts ...InvokeOption) LookupSecretResultOutput
Copy

> Note: This function is named LookupSecret in the Go SDK.

public static class GetSecret 
{
    public static Task<GetSecretResult> InvokeAsync(GetSecretArgs args, InvokeOptions? opts = null)
    public static Output<GetSecretResult> Invoke(GetSecretInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
public static Output<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: bitwarden:index/getSecret:getSecret
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Id string
Identifier.
Key string
Name.
OrganizationId string
Identifier of the organization.
Id string
Identifier.
Key string
Name.
OrganizationId string
Identifier of the organization.
id String
Identifier.
key String
Name.
organizationId String
Identifier of the organization.
id string
Identifier.
key string
Name.
organizationId string
Identifier of the organization.
id str
Identifier.
key str
Name.
organization_id str
Identifier of the organization.
id String
Identifier.
key String
Name.
organizationId String
Identifier of the organization.

getSecret Result

The following output properties are available:

Note string
Note.
OrganizationId string
Identifier of the organization.
ProjectId string
Identifier of the project.
Value string
Value.
Id string
Identifier.
Key string
Name.
Note string
Note.
OrganizationId string
Identifier of the organization.
ProjectId string
Identifier of the project.
Value string
Value.
Id string
Identifier.
Key string
Name.
note String
Note.
organizationId String
Identifier of the organization.
projectId String
Identifier of the project.
value String
Value.
id String
Identifier.
key String
Name.
note string
Note.
organizationId string
Identifier of the organization.
projectId string
Identifier of the project.
value string
Value.
id string
Identifier.
key string
Name.
note str
Note.
organization_id str
Identifier of the organization.
project_id str
Identifier of the project.
value str
Value.
id str
Identifier.
key str
Name.
note String
Note.
organizationId String
Identifier of the organization.
projectId String
Identifier of the project.
value String
Value.
id String
Identifier.
key String
Name.

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