1. Packages
  2. Akeyless Provider
  3. API Docs
  4. getSecret
akeyless 1.9.0 published on Monday, Apr 14, 2025 by akeyless-community

akeyless.getSecret

Explore with Pulumi AI

akeyless logo
akeyless 1.9.0 published on Monday, Apr 14, 2025 by akeyless-community

    Reads any secret data (currently support Static/Dynamic)

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as akeyless from "@pulumi/akeyless";
    
    const secret = akeyless.getSecret({
        path: "terraform/MyFirstSecret",
    });
    
    import pulumi
    import pulumi_akeyless as akeyless
    
    secret = akeyless.get_secret(path="terraform/MyFirstSecret")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/akeyless/akeyless"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := akeyless.GetSecret(ctx, &akeyless.GetSecretArgs{
    			Path: "terraform/MyFirstSecret",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Akeyless = Pulumi.Akeyless;
    
    return await Deployment.RunAsync(() => 
    {
        var secret = Akeyless.GetSecret.Invoke(new()
        {
            Path = "terraform/MyFirstSecret",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.akeyless.AkeylessFunctions;
    import com.pulumi.akeyless.inputs.GetSecretArgs;
    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 secret = AkeylessFunctions.getSecret(GetSecretArgs.builder()
                .path("terraform/MyFirstSecret")
                .build());
    
        }
    }
    
    variables:
      secret:
        fn::invoke:
          function: akeyless:getSecret
          arguments:
            path: terraform/MyFirstSecret
    

    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>
    def get_secret(id: Optional[str] = None,
                   path: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetSecretResult
    def get_secret_output(id: Optional[pulumi.Input[str]] = None,
                   path: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetSecretResult]
    func GetSecret(ctx *Context, args *GetSecretArgs, opts ...InvokeOption) (*GetSecretResult, error)
    func GetSecretOutput(ctx *Context, args *GetSecretOutputArgs, opts ...InvokeOption) GetSecretResultOutput

    > Note: This function is named GetSecret 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)
    }
    public static CompletableFuture<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
    public static Output<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
    
    fn::invoke:
      function: akeyless:index/getSecret:getSecret
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Path string
    The path where the secret is stored
    Id string
    The ID of this resource.
    Path string
    The path where the secret is stored
    Id string
    The ID of this resource.
    path String
    The path where the secret is stored
    id String
    The ID of this resource.
    path string
    The path where the secret is stored
    id string
    The ID of this resource.
    path str
    The path where the secret is stored
    id str
    The ID of this resource.
    path String
    The path where the secret is stored
    id String
    The ID of this resource.

    getSecret Result

    The following output properties are available:

    Id string
    The ID of this resource.
    Path string
    The path where the secret is stored
    Value string
    The secret contents
    Version double
    The version of the secret.
    Id string
    The ID of this resource.
    Path string
    The path where the secret is stored
    Value string
    The secret contents
    Version float64
    The version of the secret.
    id String
    The ID of this resource.
    path String
    The path where the secret is stored
    value String
    The secret contents
    version Double
    The version of the secret.
    id string
    The ID of this resource.
    path string
    The path where the secret is stored
    value string
    The secret contents
    version number
    The version of the secret.
    id str
    The ID of this resource.
    path str
    The path where the secret is stored
    value str
    The secret contents
    version float
    The version of the secret.
    id String
    The ID of this resource.
    path String
    The path where the secret is stored
    value String
    The secret contents
    version Number
    The version of the secret.

    Package Details

    Repository
    akeyless akeyless-community/terraform-provider-akeyless
    License
    Notes
    This Pulumi package is based on the akeyless Terraform Provider.
    akeyless logo
    akeyless 1.9.0 published on Monday, Apr 14, 2025 by akeyless-community